Heap Operations: Heapify()
Heapify(): maintain the heap property
- Given: a node i in the heap with children l and r
- Given: two subtrees rooted at l and r, assumed to be heaps
- Problem: The subtree rooted at i may violate the heap property (How?)
- Action: let the value of the parent node “float down” so subtree at i satisfies the heap property
- What do you suppose will be the basic operation between i, l, and r?