
In short
A tree-based structure that keeps the minimum (or maximum) element quickly accessible — the engine behind priority queues, used for 'top K' and scheduling problems.
How to learn this
- 1Solve a 'find the K largest/smallest elements' problem using a heap.
- 2Learn the difference between a min-heap and a max-heap.
- 3Recognize heap-shaped problems: anything about 'top K', 'kth largest', or merging sorted data.
More topics at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.