On the Best Case of Heapsort


Although discovered some 30 years ago, the Heapsort algorithm is still not completely understood. Here we investigate the best case of Heapsort. Contrary to claims made by some authors that its time complexity is O(n), i.e., linear in the number of items, we prove that it is actually O(n log n) and is, in fact, approximately half that of the worst case. Our proof contains a construction for an asymptotically best-case heap. In addition, the proof and construction provide the worst-case time complexity and an asymptotically worst-case example for Bottom-up versions of Heapsort. © 1996 Academic Press, Inc.

Publication Title

Journal of Algorithms