interface Node { value: T; priority: number; order: number; } export interface PriorityQueueOptions { /** * When true, items with equal priority are dequeued in LIFO order (newest first). * When false (default), items with equal priority are dequeued in FIFO order (oldest first). */ lifo?: boolean; /** * The compare function to use for sorting the queue. * * @default (a, b) => a.priority - b.priority */ compare?: (a: Node, b: Node) => number; /** * Invert the priority order. * * @default false */ maxHeap?: boolean; } /** * A pure data structure that maintains a set of ordered items by numeric priority. * Lower priority numbers dequeue first. Ties are broken by insertion order. * * Time Complexity: * - Enqueue: O(log n) * - Dequeue: O(log n) * - Peek: O(1) * * Space Complexity: O(n) where n is the number of items in the queue */ export declare class PriorityQueue { constructor(options?: PriorityQueueOptions); /** * Adds a new item into the queue. * @param value The payload associated with the item * @param priority Numeric priority (lower = higher priority) * * Time Complexity: O(log n) * Space Complexity: O(1) */ push(value: T, priority?: number): void; /** * Removes and returns the highest-priority item. * Returns null if the queue is empty. * * Time Complexity: O(log n) * Space Complexity: O(1) */ pop(): T | null; /** * Removes and returns many items from the queue. * Returns an empty array if the queue is empty. */ popMany(count?: number): T[]; /** * Returns the next item to be dequeued without removing it. */ peek(): T | null; /** * Returns the next item to be dequeued without removing it. */ peekMany(count?: number): T[]; /** * Find an item in the queue by predicate. */ find(predicate: (value: T) => boolean): T | null; /** * Heapify the queue. * * Time Complexity: O(n) * Space Complexity: O(n) */ heapify(items: Node[]): void; clone(): PriorityQueue; /** * Returns a sorted array of the queue. */ toSortedArray(): T[]; /** * Returns an iterator over the queue. */ [Symbol.iterator](): IterableIterator; /** * Returns the number of items in the queue. */ size(): number; /** * Returns true if the queue is empty. */ isEmpty(): boolean; /** * Clears all items and resets the insertion counter. */ clear(): void; } export {};