Binary Heap
Domain: Data Structures
šÆ Motivation
A heap implemented as a complete binary tree stored in an array. Parent at index i has children at 2i+1 and 2i+2.
š Concrete Example
Array [10, 5, 3, 1, 2] represents a max-heap: index 0 (10) has children at index 1 (5) and 2 (3). No gaps in the tree.
š Analogy
A fully packed stadium where every row is filled left to right before the next row starts. You know exactly where row iās seats are without a map.