Using a list of 15 numbers, I need to give a list representing the best and worst case scenario. It says "q.s. uses the first item in the list as the pivot item". I'm not sure if I pick the first item as pivot every time, but that's what I'm assuming....
For best case scenario.. I came up with (bold for pivot, italic for bigger and smaller than markers):
8 1 3 2 6 5 7 4 12 9 11 10 14 13 15
4 1 3 2 6 5 7--8--12 9 11 10 14 13 15
2 1 3 --4--6 5 7........8........10 9 11--12--14 13 15
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Hope someone can here can verify my work and if it's wrong, point out to me how and why.
See Question&Answers more detail:os