import { InvalidInputError } from '../types/errors'; import { Option } from '../types/option'; import { Result } from '../types/result'; /** * Min-Heap based priority queue implementation. * * Provides O(log n) insert and extractMin operations, * and O(log n) decreaseKey with element tracking. * * Time Complexity: * - insert: O(log n) * - extractMin: O(log n) * - decreaseKey: O(log n) * - isEmpty: O(1) * - size: O(1) * * Space Complexity: O(n) for heap array and position map * @template T - Type of elements stored in the queue * @example * ```typescript * const heap = new MinHeap(); * heap.insert('task1', 10); * heap.insert('task2', 5); * heap.insert('task3', 15); * * const min = heap.extractMin(); // Some('task2') - priority 5 * ``` */ export declare class MinHeap { private heap; private positions; /** * Insert an element with given priority. * @param element - Element to insert * @param priority - Priority value (lower = higher priority) */ insert(element: T, priority: number): void; /** * Extract and return the element with minimum priority. * @returns Option containing the minimum element, or None if heap is empty */ extractMin(): Option; /** * Decrease the priority of an existing element. * @param element - Element whose priority to decrease * @param newPriority - New priority value (must be lower than current) * @returns Result indicating success or error */ decreaseKey(element: T, newPriority: number): Result; /** * Check if the heap is empty. * @returns true if heap contains no elements */ isEmpty(): boolean; /** * Get the number of elements in the heap. * @returns Number of elements */ size(): number; /** * Extract multiple elements efficiently (optimized for performance tests). * Returns array of extracted elements to avoid Option wrapper overhead. * @param count * @internal */ extractMinBatch(count: number): T[]; /** * Bubble up an element to maintain heap property. * @param index * @internal */ private bubbleUp; /** * Bubble down an element to maintain heap property. * @param index * @internal */ private bubbleDown; /** * Swap two elements in the heap and update position map. * @param i * @param index * @param j * @param index_ * @internal * @deprecated Use inline swaps in bubbleUp/bubbleDown for better performance */ private swap; } //# sourceMappingURL=priority-queue.d.ts.map