Problem Statement
Sort an array of integers using Heap Sort.
Approach
Build a Max Heap from the input data. The largest item is stored at the root. Replace it with the last item of the heap followed by reducing the size of heap by 1. Heapify the root of the tree. Repeat until heap size is 1.
Time & Space Complexity
Time complexity is O(n log n). Space complexity is O(1).
