Peek at the minimum or maximum in O(1).
Heaps and Priority Queues
6 chapters · 8 challenges · The Summit Forge
Understand the idea, practise through play, then prove it in code. Choose your next quest below.
Visual introduction to this topic
What is a heap?
A heap is a partially ordered tree that keeps the smallest or largest candidate at its root. It does not sort everything; it protects the next priority.
Think of a live priority desk. New jobs can arrive at any time, but the most urgent valid job must always be easy to take next.
The root is guaranteed; siblings and distant branches need not be sorted.
Push and pop repair one root-to-leaf path.
A size-k heap turns many top-k problems into O(n log k) work.
Keep only the strongest candidates
Top K
0/2 completePractice top K through 2 visual expeditions.
K-Way Merge
0/1 completePractice K-way merge through 2 visual expeditions.
Two Heaps
0/1 completePractice two heaps through 1 visual expedition.
Streaming Median
0/1 completePractice streaming median through 1 visual expedition.
Scheduling
0/2 completePractice scheduling through 2 visual expeditions.
Final challenge
0/1 completeCombine the skills from this world in a final challenge.
Built from authoritative material
This track is checked against the sources below. Visual traces still carry their own complete or guided coverage label, so unfinished explanations are not presented as complete executions.