In inline heapsort we use only single array throughout the program to decrease the running time, where as, in simple heap sort we use external data structure memory usage of more than O(1) at a time. Please consider the below inline heap program which prints out the running time, which is lesser to the the simple heap sort. //program class heapsort { private final int array[]; // The array being sorted heapsort(int array[], int N) { this.array = array; int Last = N-1; // its children are at elements 2*I+1 and 2*I+2. // phase 1: form heap // Construct heap bottom-up, starting with small trees just above leaves // and coalescing into larger trees near the root. for( int Top = Last/2; Top >= 0; Top-- ) { adjust(Top, Last); } // phase 2: use heap to sort // Move top element (largest) out of heap, swapping with last element // and changing the heap boundary, until only one element remains. while( Last > 0 ) { swap(0, Last); adjust(0, --Last); } } /** * adjust(Top, Last) adjusts the tree between Top and Last **/ void adjust(int Top, int Last) { int TopVal = array[Top]; // Set aside top of heap int Parent, Child; for( Parent = Top; ; Parent = Child ) // Iterate down through tree { Child = 2*Parent+1; // Child means left child if( Child > Last ) break; // Left child non-existent if( Child+1 <= Last // Right child exists && array[Child] < array[Child+1] ) // and right child is larger Child++; // Child is the larger child if( TopVal >= array[Child] ) break; // Location for TopVal found array[Parent] = array[Child]; // Move larger child up in tree } array[Parent] = TopVal; // Install TopVal in place } //swapping void swap(int i, int j) { int temp = array[i]; array[i] = array[j]; array[j] = temp; } public static void main(String[] args) { int N = 0; // number of elements in array int array[] = {43,65,12,89,11,5,1,88,123,999,233,18,553,332,144,98,452,7663,111,23,654,8735,998}; //initialising array N=array.length; System.err.println(\"Sorting started\"); long startTime = System.nanoTime(); new heapsort(array, N); // sorting long endTime = System.nanoTime(); long totalTime = endTime - startTime; for( int i = 0; i < N; i++ ) { System.out.print(array[i] + \" \"); } System.out.println(); System.out.println(\"Time in nanos\"+totalTime); } } //runn the above program for inline heap sort. Solution In inline heapsort we use only single array throughout the program to decrease the running time, where as, in simple heap sort we use external data structure memory usage of more than O(1) at a time. Please consider the below inline heap program which prints out the running time, which is lesser to the the simple heap sort. //program class heapsort { private final int array[]; // The array being sorted heapsort(int array[], int N) { this.array = array; int Last = N-1; // its children are at elements 2*I+1 and 2*I+2. // phase 1: form heap // Construct heap bottom-up, starting with small trees just above leaves // and coalescing into larger trees near the root. for( int T.