advanced sorting listing continued for(int = <maxsizej++/fill array with /random numbers long (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 this program uses another new methodmanualsort()to sort subarrays of three or fewer elements it returns immediately if the subarray is one cell (or less)swaps the cells if necessary if the range is and sorts three cells if the range is the recquicksort(routine can' be used to sort ranges of or because median partitioning requires at least four cells the main(routine and the output of quicksort java are similar to those of quicksort java the quicksort workshop applet the quicksort workshop applet demonstrates the quicksort algorithm using median-of-three partitioning this applet is similar to the quicksort workshop appletbut starts off sorting the firstcenterand left elements of each subarray and selecting the median of these as the pivot value at leastit does this if the array size is greater than if the subarray is two or three unitsthe applet simply sorts it "by handwithout partitioning or recursive calls notice the dramatic improvement in performance when the applet is used to sort inversely ordered bars no longer is every subarray partitioned into cell and - cellsinsteadthe subarrays are partitioned roughly in half other than this improvement for ordered datathe quicksort workshop applet produces results similar to quicksort it is no faster when sorting random datait' advantages become evident only when sorting ordered data handling small partitions if you use the median-of-three partitioning methodit follows that the quicksort algorithm won' work for partitions of three or fewer items the number in this case is called cutoff point in the examples above we sorted subarrays of two or three items by hand is this the best way