/end main(/display them again /end class quicksort app this program uses another new methodmanualsort()to sort subarrays of or fewer elements it returns immediately if the subarray is cell (or less)swaps the cells if necessary if the range is and sorts cells if the range is the recquicksort(routine can' be used to sort ranges of or because median partitioning requires at least 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-ofthree 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 or 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 previous examples we sorted subarrays of or items by hand is this the best wayusing an insertion sort for small partitions another option for dealing with small partitions is to use the insertion sort when you do thisyou aren' restricted to cutoff of you can set the cutoff to or any other number it' interesting to experiment with different values of the cutoff to see where the best performance lies knuth (see the bibliographyrecommends cutoff of howeverthe optimum number depends on your computeroperating systemcompiler (or interpreter)and so on the quicksort java programshown in listing uses an insertion sort to handle subarrays of fewer than cells listing the quicksort java program /quicksort java /demonstrates quick sortuses insertion sort for cleanup /to run this programc>java quicksort app ///////////////////////////////////////////////////////////////class arrayins