next up previous
Next: Pseudocode Up: CSE 2320: Algorithms and Previous: Exercise 7.1-2

Maintaining the Heap Property



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.

Copyright © 1998 The University of Texas at Arlington