* refactor: clean to roadmap content * refactor: move shared helpers into scripts/lib
9 lines
944 B
Markdown
9 lines
944 B
Markdown
# 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:
|
|
|
|
- [@article@Priority Queue](https://www.programiz.com/dsa/priority-queue)
|
|
- [@video@Learn Priority Queue data structures in 5 minutes 🥇](https://www.youtube.com/watch?v=7z_HXFZqXqc)
|
|
- [@video@Heaps in 3 minutes — Intro](https://www.youtube.com/watch?v=0wPlzMU-k00) |