## The call to BuildHeap() takes O(n) time

## Each of the n - 1 calls to Heapify() takes O(lg n) time

## Thus the total time taken by HeapSort() = O(n) + (n - 1) O(lg n)= O(n) + O(n lg n)= O(n lg n)

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