Medium · O(n log n) avg, O(n²) worst
Quick Sort quiz
Answer the questions in your own time, change a pick whenever you like, then hand in to see your score and why each answer is right. Nothing is saved or sent.
Questions (10)
- Viewing
- Answered
- Not answered
This quick sort picks its pivot as the median of three. Which value is the pivot for [7, 2, 9, 4, 3, 8, 1]?
With pivot 4, Hoare's partition runs on [1, 2, 9, 4, 3, 8, 7]. Where does it split?
After a Hoare partition returns split, which ranges does the code sort next?
What is quick sort's average time complexity, and its worst case?
Why does a median-of-three pivot beat "always take the first element"?
The array is [3, 3, 3, 3, 3, 3]. How does Hoare's partition split it?
How deep can this code's call stack get?
Is quick sort stable?
Why does the code take the pivot from the middle index rather than the last one (hi)?
You need the k-th smallest value, not a sorted array. What does Quickselect do, and how fast is it on average?
Progress
0 / 10 questions0%
10 questions left
Quiz details
- Total questions
- 10
- Answered
- 0
- Not answered
- 10
Take it further
- AnimationSorting
Quick Sort Animation
Quick sort, step by step: the pivot, Hoare's two pointers and a call stack that stays shallow
Free
