The test's questions that a run answers, asked again on new numbers whenever you like. The answer, its working and the reason for every other choice come from quick sort's own run on the numbers shown.
choose one
1question 1
Quick sort starts on 33, 8, 27, 14, 46, 21. What is the row just after its first pivot is placed?
the answer, and why
the answer is B
The pivot is 21. The 8 swaps with the 33, onto the small side. Then the 14 swaps with the 33. Then 21 swaps with the 27 just after them.
if you chose another
AThat sorts the right part too, which waits for later splits.
Which row costs quick sort the fewest comparisons?
the answer, and why
the answer is B
Its first pivot, 4, is the middle in size, and so are the pivots after it. That costs 13. The rows in order and back to front cost 28, and 42, 7, 31, 18, 56, 23, 12, 49 costs 17.
if you chose another
AIn order, every pivot is the biggest left, the dearest kind of row.
CBack to front, the pivots are the smallest and the biggest left in turn, which is just as dear.
DIts first pivot, 49, leaves almost everything on one side. It costs 17.