divide step is performed by scanning the array simultaneously using local variables leftwhich advances forwardand rightwhich advances backwardswapping pairs of elements that are in reverse orderas shown in figure when these two indices pass each otherthe division step is complete and the algorithm completes by recurring on these two sublists there is no explicit "combinestepbecause the concatenation of the two sublists is implicit to the in-place use of the original list it is worth noting that if sequence has duplicate valueswe are not explicitly creating three sublists leand gas in our original quick-sort description we instead allow elements equal to the pivot (other than the pivot itself to be dispersed across the two sublists exercise - explores the subtlety of our implementation in the presence of duplicate keysand exercise - describes an in-place algorithm that strictly partitions into three sublists leand ( (cl (bl (al lr ( ( (gfigure divide step of in-place quick-sortusing index as shorthand for identifier leftand index as shorthand for identifier right index scans the sequence from left to rightand index scans the sequence from right to left swap is performed when is at an element as large as the pivot and is at an element as small as the pivot final swap with the pivotin part ( )completes the divide step