A comparison-based sorting algorithm that uses a binary heap data structure to create a sorted array by repeatedly extracting the maximum element.
Heap sort is an efficient comparison-based sorting algorithm that uses a binary heap data structure. It works by first building a max heap from the input data, then repeatedly extracting the maximum element from the heap and placing it at the end of the sorted array. It has guaranteed O(n log n) time complexity and O(1) space complexity, making it suitable for large datasets.