Heapsort has a worst case running time of O(n log n) just like mergesort and it has the storage efficiency of quicksort.
Like selectionsort, heapsort is an interchange sorting-algorithm that works by repeatedly interchanging pairs of array elements. Thus heapsort needs only some small constant amount of storage in addition to the array that holds the elements to be sorted. Selectionsort locates the largest value and places it in the final array position. Then it locates the largest value and places it in the final array position and so forth. Heapsort uses a similar strategy, locating the largest value, then the next to the largest and so on. However heapsort uses a much more efficient algorithm.