heap sort in-place
Heap sort is a comparison-based sorting algorithm that transforms an array into a heap data structure, where the largest element is at the root. The algorithm then repeatedly swaps the root with the last element, reducing the heap size, and maintains the property that the largest element is at the top. This process continues until the heap is sorted in ascending order. "In-place" refers to the property of heap sort where the sorting algorithm operates directly on the input array without requiring additional memory space. In other words, heap sort rearranges the elements within the same input array, rather than creating a separate array for sorting. This reduces the space complexity of the sorting algorithm.
Requires login.