//This program compares the execution time of //Quick sort and Selection sort on different input sizes. //For each input size, it generate 25 random instances of array //and calculate the time taken by Quick sort and Selection sort //on all of them. Note that We execute the two algorithms on same input. //It uses System.currentTimeMillis() which returns //a long integer corresponding to the curent time in milli seconds. //Compile it and execute it to see the output. import java.util.Random; class Three_sorting_algos { //--------------------------------------------------------------------- //------------Method swap() used by Selection Sort and Quick sort------ //--------------------------------------------------------------------- public static void swap(int[] A, int i, int j) { int temp = A[i]; A[i] = A[j]; A[j] = temp; } //--------------------------------------------------------------------- //---------------------Now SELECTION SORT and-------------------------- //-------------the method index_of_smallest_value used by it------------ //---------------------------------------------------------------------- public static int index_of_smallest_value(int[] B,int start, int end) { int index_of_smallest = start; int index = start+1; for(;index<=end; index=index+1) { if(B[index_of_smallest] > B[index]) index_of_smallest = index; } return index_of_smallest; } public static void SelectionSort(int[] B) { for(int index=0;index