Build a Priority Queue / Heap
Build a binary heap from scratch: the array layout, sift-up/sift-down, push/pop/peek, O(n) heapify, indexed heap with decrease-key, top-K streaming, median finding, and merge K sorted lists. The data structure behind Dijkstra, Huffman, and most schedulers.
beginner8 lessons4 chapters8 graded exercisesPython
No sign-up needed for lesson 1 · certificate on completion · sign up to save progress
What you’ll have built
Chapter by chapter. Every step is a graded exercise.
- Heap Property
- Operations
- Variants
- Applications
Starts in Python — solve in the language you choose in the editor, same tests either way.
Curriculum
4 chapters, 8 lessons. Each lesson is a short read, one graded exercise, and a quiz.
- 1The Heap PropertyRead · exercise · quiz
- 2Complete Binary TreeRead · exercise · quiz
Loading reference solution…