Heap Sort
Time Complexity - O(nlogn) We use min-heap if we want to sort in ascending order and max heap if we want to sort in descending order. We insert one by one into the heap, heapifying from bottom to top while inserting in order to maintain corresponding heap property. Now, after all elements are insered into the heap, we extract elements one by one. Remember- we can only extract the root of a heap. Also, after extraction, we put the last element in the level order traversal of heap as the new root and again heapify from top to bottom this time, in order to maintain the corresponding heap property. It is not a stable sort __________________________________________________________________________________________________________________________________________________________________ public class Main { int[] heapArr; int endOfHeap; Main(int size){ this.heapArr...