Least You Need to Know: K-Way Merge, Top-K, and Heap Frontier Ideas
Abrir lição
Heaps are useful when many sorted or partially ordered sources expose only a few promising next candidates. The heap stores the current **frontier** so you can pop the next best item without materializing every unseen option.