Heap Sort.
Builds a max-heap from the array, then repeatedly extracts the maximum element to produce a sorted array in-place.
Time complexity : O(n log n) in all cases Space complexity: O(1)
Sorts the array in ascending natural order.
Sorts an IntArray in ascending order.
Sorts the array using the given comparator.