I recently saw Quick Sort - Computerphile
video on Youtube about how quicksort works (on paper) and I have a question. Imagine that we have an array that contains for example "27,6,19,2,15,9,10"
. In first place I choose 10
as pivot and the array becomes like this: 9,2,6 |10| 27,19,15
. Then I choose 6
as pivot for the left unsorted array and it becomes 2 |6| 9
and for the right one I choose 19
as a pivot and the right unsorted array becomes 15 |19| 27
. The question is: Can I choose any pivot I want to make my job easier (like I did in this example) or there is something more?
Edit: If I chose 27 as pivot instead of 19 how the array would be?