Back to curriculum
Course section
Heaps & Priority Queues
Maintain the most urgent element efficiently with complete binary heaps and priority queues.
3 topics01
Binary Heap
A binary heap is a complete binary tree stored compactly in an array and ordered by a min-heap or max-heap property.
ComplexityC++ implementation Worked trace
02
Priority Queue
A priority queue returns the highest- or lowest-priority item rather than the oldest item, commonly using a heap.
ComplexityC++ implementation
03
Heap Sort
Heap sort builds a max heap and repeatedly moves its root to the end while restoring the heap property.
ComplexityC++ implementation Worked trace