next up previous
Next: Up: Previous:

Maintaining the Heap Property



Heapify(A,i)



\psfig{figure=figures/f3-3.ps,width=4in,height=3in}

Notice that if A[left(i)] > A[i] or if A[right(i)] > A[i] or both (take largest) then swap and recurse until recursion bottoms out at bottom of heap.


next up previous
Next: Up: Previous: