juniorHeaps and Maps
Explain Min-Heap vs Max-Heap.
Updated Apr 28, 2026
Short answer
In a Min-Heap, the parent is smaller than children; in a Max-Heap, the parent is larger.
Deep explanation
Heaps and Maps are fundamental for optimization. In a Min-Heap, the parent is smaller than children; in a Max-Heap, the parent is larger. Heaps are used for priority management, while Maps provide constant-time data retrieval.
Real-world example
Priority queues in operating systems.
Common mistakes
- Confusing a Heap with a sorted array.
Follow-up questions
- Is a Heap a sorted structure?