Explore Library
Quiz

Heap Array Indexing & Representations

Understand how binary heaps map to arrays and when array vs pointer representations win.

A binary heap is stored in a 0-indexed array. For the node at index i, which formulas correctly give its left child, right child, and parent — and why is this array representation preferred over a pointer-based tree for a heap?