Heapsort is an efficient in-place comparison based sorting algorithm with O(N log N) time complexity and uses a data structure to achieve it. It uses a complete Binary Heap data structure to sort the elements depending on whether the heap is Min Heap (ascending) or Max heap (descending). A binary heap is a complete binary tree, that is, all the levels of the tree are completely filled except, possibly the last level. And the insertion of elements is done from the left and goes to right.
Read this article to understand Heap Sort in depth
Have a doubt or thought? Join the discussion now
This is a companion discussion topic for the original entry at http://iq.opengenus.org/heap-sort/