although there are fewer swaps than comparisonsthey are both proportional to thusthe partitioning process runs in (ntime running the workshop appletyou can see that for random bars there are about swaps and comparisonsand for random bars there are about swaps and comparisons quicksort quicksort is undoubtedly the most popular sorting algorithmand for good reasonin the majority of situationsit' the fastestoperating in ( *logntime (this is only true for internal or in-memory sortingfor sorting data in disk filesother algorithms may be better quicksort was discovered by hoare in to understand quicksortyou should be familiar with the partitioning algorithm described in the preceding section basicallythe quicksort algorithm operates by partitioning an array into two subarrays and then calling itself recursively to quicksort each of these subarrays howeverthere are some embellishments we can make to this basic scheme they have to do with the selection of the pivot and the sorting of small partitions we'll examine these refinements after we've looked at simple version of the main algorithm it' difficult to understand what quicksort is doing before you understand how it does itso we'll reverse our usual presentation and show the java code for quicksort before presenting the quicksort workshop applet the quicksort algorithm the code for basic recursive quicksort method is fairly simple here' an examplepublic void recquicksort(int leftint rightif(right-left < /if size is return/it' already sorted else /size is or larger /partition range int partition partitionit(leftright)recquicksort(leftpartition- )/sort left side recquicksort(partition+ right)/sort right side as you can seethere are three basic steps partition the array or subarray into left (smaller keysand right (larger keysgroups