advanced sorting pivot this means that the leftptr and rightptr indices can' step beyond the right or left ends of the arrayrespectivelyeven if we remove the leftptr>right and rightptr<left tests (the pointer will stopthinking it needs to swap the itemonly to find that it has crossed the other pointer and the partition is complete the values at left and right act as sentinels to keep leftptr and rightptr confined to valid array values left center right left center right before sorting after sorting becomes pivot figure sorting the leftcenterand right elements another small benefit to median-of-three partitioning is that after the leftcenterand right elements are sortedthe partition process doesn' need to examine these elements again the partition can begin at left+ and right- because left and right have in effect already been partitioned we know that left is in the correct partition because it' on the left and it' less than the pivotand right is in the correct place because it' on the right and it' greater than the pivot thusmedian-of-three partitioning not only avoids ( performance for alreadysorted datait also allows us to speed up the inner loops of the partitioning algorithm and reduce slightly the number of items that must be partitioned the quicksort java program listing shows the quicksort java programwhich incorporates median-of-three partitioning we use separate methodmedianof ()to sort the leftcenterand right elements of subarray this method returns the value of the pivotwhich is then sent to the partitionit(method