Array Representation of Heap
Because a heap is complete, it can be stored compactly in an array without explicit child pointers. For zero-based indexing, the parent of index i is (i-1)/2, the left child is 2i+1, and the right child is 2i+2. This representation provides excellent cache locality and avoids pointer overhead.
Zero-based arrays are most commonly used.
No null slots are required for missing children.
The complete-tree property guarantees compact storage.
Heap operations rearrange array elements using swaps.