next up previous contents index Search
Next: 0.3.3.5 Source Code Up: 0.3.3 Heapsort Previous: 0.3.3.3 Operations on a

0.3.3.4 Analysis

While the Heapsort is a constant factor slower than the Quicksort for average data sets, it still has a complexity of (n log2 n) for best, worst and average data. It also has some interesting properties that make it particularly useful for sorting data sets that are too large to fit into primary computer memory.

As we have seen, the initial heapification operation is a linear time complexity process. The push-down operation described is only a     variation of the heapify process. In the worst case 2i comparisons will be needed to fully demote a given node from the root to its proper place.

Scott Gasch
1999-07-09