es-next-tools
Version:
A comprehensive utility library for JavaScript and TypeScript that provides a wide range of functions for common programming tasks, including mathematical operations, date manipulations, array and object handling, string utilities, and more.
21 lines (20 loc) • 628 B
TypeScript
/**
* Represents a priority queue using a binary heap.
* @template T The type of elements in the priority queue.
*/
export declare class PriorityQueueHeap<T> {
private heap;
/**
* Inserts an item into the priority queue.
* @param {T} value - The item to insert.
* @param {number} priority - The priority of the item.
*/
enqueue(value: T, priority: number): void;
/**
* Removes and returns the item with the highest priority.
* @returns {T | undefined} The item removed, or undefined if empty.
*/
dequeue(): T | undefined;
private bubbleUp;
private bubbleDown;
}