Given the list of numbers: 2 5 1 8 4 10 6 3 7 9 0
The actual implementation of quick sort I understand, but a question on my homework that I didn't was:
What is the optimal choice of pivot, why?
I had assumed when reading this that the obvious choice for a pivot would be the 5 or 6 since its in the middle of the list. I figured quick sort would work either way though since we choose a new pivot every time. Which makes the followup question make a little more sense, but does anyone have a formal definition?
Why is an optimal pivot not practical?