Trees line
Heap / Priority Queue problems
A heap always hands back its smallest or largest item, and adding or removing one is fast. The problems keep the best k items, merge sorted streams, or pick the next most urgent job.
- 2 easy
- 4 medium
- 1 hard
The 7 problems
In the order the app teaches them. Each page has the problem, five hints and the explained solution.
On the roadmap
Heap / Priority Queue is a station on the trees line. It builds on Tries. Next comes Advanced Graphs.
The roadmap says why each line runs in its order.
Patterns
5 patterns solve these problems. Naming them gives the problems’ methods away, so the list is folded.
Show the 5
- Heap of the best k3 problems
- Heap as a priority queue1 problem
- Frequency counting1 problem
- Purpose-built data structure1 problem
- Two heaps1 problem