sorting select pivot partition quicksort small quicksort large figure the steps of quicksort illustrated by example wrong way the popularuninformed choice is to use the first element as the pivot this is acceptable if the input is randombut if the input is presorted or in reverse orderthen the pivot provides poor partitionbecause either all the elements go into or they go into worsethis happens consistently throughout the recursive calls the practical effect is that if the first element is used as the pivot and the input is presortedthen quicksort will take quadratic time to do essentially nothing at allwhich is quite embarrassing moreoverpresorted input (or input with large presorted sectionis quite frequentso using the first element as pivot is an absolutely horrible idea and should be discarded immediately an alternative is choosing the larger of the first two distinct elements as pivotbut this has