/** How the comparison function needs to work */ export type PriorityCompare = (a: T, b: T) => number; /** * # Priority Queue * * ## Description * A priority queue is a data structure that stores elements in a specific order. * * ## Usage * * ```ts * import { PriorityQueue } from 's2-tools'; * * const queue = new PriorityQueue(); * * queue.push(1); * queue.push(2); * * const current = queue.peek(); // 1 * console.log(queue.length); // 2 * let next = queue.pop(); // 1 * console.log(queue.length); // 1 * next = queue.pop(); // 2 * console.log(queue.length); // 0 * ``` */ export declare class PriorityQueue { #private; private data; private compare; /** * @param data - initial data * @param compare - compare function */ constructor(data?: T[], compare?: PriorityCompare); /** @returns - the number of items */ get length(): number; /** * Push an item into the queue * @param item - the item to store */ push(item: T): void; /** * Access the top item, remove it, and return it * @returns - the top item */ pop(): T | undefined; /** * Peek at the top item without removing it * @returns - the top item */ peek(): T | undefined; } //# sourceMappingURL=priorityQueue.d.ts.map