## Fixing up relationships between i, l, and r takes ?(1) time

## If the heap at i has n elements, how many elements can the subtrees at l or r have?

- Draw it

## Answer: 2n/3 (worst case: bottom row 1/2 full)

## So time taken by Heapify() is given by

Previous slide | Next slide | Back to first slide | View graphic version |