First page Back Continue Last page Graphics
Rebuilding the array as a heap
Conceptually divide the array into two segments:
- The left segment will always be a valid heap.
- This segment starts out empty.
- The boundary of this segment will grow to include all items in the array
- The right segment will contain the elements remaining that have not yet be incorporated into the left (heap) segment.
- This segment starts out containing all elements
- This segment will shrink as elements are incorporated into the heap section and will eventually become empty.