I was given this question and was hoping someone can let me know if my answer is correct.
How many recursive calls are necessary when quickSort sorts an array of size n if you use median-of-three pivot selection? State any assumptions you make about the value of n.
I say the answer is n because when you use median-of-three isnt that the best case scenario?
To paraphrase, take the middle and end elements of an array, sort them, and use the middle element as pivot.
This guarantees that you will never have the worst-case scenario of picking a pivot which contains the lowest or highest value in the array.
I've got no idea of exactly how many recursive calls would be necessary though. I guess since arrays of 3 elements or less will be sorted before you do the quicksort, the number of recursive calls should be 2 less than normal.