## To Heapify() a subtree takes O(h) time where h is the height of the subtree

- h = O(lg m), m = # nodes in subtree
- The height of most subtrees is small

## Fact: an n-element heap has at most ?n/2h+1? nodes of height h

## CLR 7.3 uses this fact to prove that BuildHeap() takes O(n) time

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