Look at node i (initially the root).

We know that the only node that may violate the heap property is a child of the new i. (Why?)

Kind of like bubblesort or insertion sort in a tree. The root value trickles down until it stops.

Running Time? (Maximum number of comparisons and swaps.)

next up previous
Next: Up-Heapify Up: HEAPS Previous: Maintaining the Heap Property