Why choose a random pivot in quicksort
So choosing a pivot at random has O(n 2 ) running at worst case but when the pivot is chosen as the average of min value and max value of the list you get a worst case O(n log n). Of course there are the added 2*O(n) on each recursion due to finding the min and max values as opposed to the constant O(1) of the random generator has. When implementing this as the pivot you get the list sorted at the leaves of the recursion tree instead in the standard algorithm elements get sorted from the root to leaves. When implementing instead of the pivot being a value on the list it is just a number