mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2026-10-25 09:34:00 +08:00
* refactor: clean to roadmap content * refactor: move shared helpers into scripts/lib
944 B
944 B
Heaps and Priority Queue
A heap is the right data structure when you repeatedly need the largest or smallest element from a changing collection. The problems in this stage cover three heap patterns: top-k elements (maintain a heap of size k), two heaps (split a dataset into two halves to track the median), and k-way merge (combine multiple sorted sequences using a single heap). If you find yourself wanting to sort something repeatedly as new elements arrive, a heap is almost always the better choice. Getting comfortable with heap operations and knowing which variant to reach for is the main skill this stage develops.
Visit the following resources to learn more: