enough space for sets of arguments and return valuesone for each recursion level this isas we'll see latersomewhat greater than the logarithm to the base of the number of itemslog the size of the machine stack is determined by your particular system sorting very large numbers of data items using recursive procedures may cause this stack to overflowleading to memory errors things to notice here are some details you may notice as you run the quicksort workshop applet you might think that powerful algorithm like quicksort would not be able to handle subarrays as small as or items howeverthis version of the quicksort algorithm is quite capable of sorting such small subarraysleftscan and rightscan just don' go very far before they meet for this reason we don' need to use different sorting scheme for small subarrays (althoughas we'll see laterhandling small subarrays differently may have advantages at the end of each scanthe leftscan variable ends up pointing to the partition--that isthe left element of the right subarray the pivot is then swapped with the partition to put the pivot in its proper placeas we've seen as we notedin steps and of figure leftscan ends up pointing to the pivot itselfso the swap has no effect this may seem like wasted swapyou might decide that leftscan should stop one bar sooner howeverit' important that leftscan scan all the way to the pivototherwisea swap would unsort the pivot and the partition be aware that leftscan and rightscan start at left- and right this may look peculiar on the displayespecially if left is then leftscan will start at - similarly rightscan initially points to the pivotwhich is not included in the partitioning process these pointers start outside the subarray being partitionedbecause they will be incremented and decremented respectively before they're used the first time the applet shows ranges as numbers in parenthesesfor example( - means the subarray from index to index the range given in some of the messages may be negativefrom higher number to lower onearray partitionedleft ( - )right ( - )for example the ( - range means single cell ( )but what does ( meanthis range isn' realit simply reflects the values that left and rightthe arguments to recquicksort()have when this method is called here' the code in questionint partition partitionit(leftrightpivot)recquicksort(leftpartition- )/sort left side recquicksort(partition+ right)/sort right side if partitionit(is called with left and right for exampleand happens to return as the partitionthen the range supplied in the first call to recquicksort(will be ( - and the range to the second will be ( - this is normal the base case in recquicksort(is activated by array sizes less than as well as by so it will return immediately for negative ranges negative ranges are not shown in figure although they do cause (briefcalls to recquicksort(degenerates to ( performance if you use the quicksort workshop applet to sort inversely sorted barsyou'll see that the algorithm runs much more slowly and that many more dotted horizontal lines are generatedindicating more and larger subarrays are being partitioned what' happening here