A Variant of Heapsort with Almost Optimal Number of Comparisons

Abstract An algorithm, which asymptotically halves the number of comparisons made by the common Heapsort , is presented and analysed in the worst case. The number of comparisons is shown to be (n+1)(log(n+1)+log log(n+1)+1.82)+O(log n) in the worst case to sort n elements, without using any extra space. Quicksort , which usually is referred to as the fastest in-place sorting method, uses 1.38n log n − O(n) in the average case (see Gonnet (1984)).