Heap Operations: BuildHeap()
We can build a heap in a bottom-up manner by running Heapify() on successive subarrays
- Fact: for array of length n, all elements in range A[?n/2? + 1 .. n] are heaps (Why?)
- Walk backwards through the array from n/2 to 1, calling Heapify() on each node.
- Order of processing guarantees that the children of node i are heaps when i is processed