Maintaining the Heap Property
- MAX-HEAPIFY used to maintain the max-heap property
- Inputs: an array \(A\) and an index \(i\)
- MAX-HEAPIFY assumes that binary trees rooted at LEFT(i) and RIGHT(i) are max-heaps, but that \(A[i]\) might be smaller than its children (violating the max-heap property)
- MAX-HEAPIFY moves the value \(A[i]\) down in the max-heap so that subtree rooted at index \(i\) follows the max-heap property