Heaps
Heaps can be viewed as trees with top-to-bottom ordering.
Heaps are typically implemented via arrays.
Simple index calculations allow navigation through the tree:
- left child of
Item at index i is located at 2i
- right child of
Item at index i is located at 2i+1
- parent of
Item at index i is located at i/2
|