Loading...
Loading...
Loading Curriculum...
Loading Subject...
Loading Topic...
Loading Lesson...
Loading Lab...
A special type of queue where the element with the HIGHEST priority is always at the front. By default, it's a Max-Heap (largest element first).
push(val): Adds element in O(log N).pop(): Removes top element in O(log N).top(): Returns highest priority element in O(1).priority_queue<int, vector<int>, greater<int>> pq;
Essential for Dijkstra's Algorithm, Prim's Algorithm, Huffman Coding, and K-way merging of sorted lists.