int inoutout right /sorted on left of for(out=left+ out<=rightout++double temp thearray[out]/remove marked item in out/start shifts at out /until one is smallerwhile(in>left &thearray[in- >tempthearray[inthearray[in- ]/shift item to --inthearray[intemp/end for /end insertionsort(/go left one position /insert marked item ///end class arrayins ///////////////////////////////////////////////////////////////class quicksort app public static void main(string[argsint maxsize /array size arrayins arr/reference to array arr new arrayins(maxsize)/create the array for(int = <maxsizej++/fill array with /random numbers double (int)(java lang math random()* )arr insert( )arr display()/display items arr quicksort()/quicksort them arr display()/display them again /end main(/end class quicksort app using the insertion sort for small subarrays turns out to be the fastest approach on our particular installationbut it is not much faster than sorting subarrays of or fewer cells by handas in quicksort java the numbers of comparisons and copies are reduced substantially in the quicksort phasebut are increased by an almost equal amount in the insertion sortso the time savings are not dramatic howeverit' probably worthwhile approach if you are trying to squeeze the last ounce of performance out of quicksort insertion sort following quicksort