← All topics
Quiz: Merge Sort and Quick Sort: questions with answers
13 questions, each with the answer and a short explanation.
Take the timed quiz + get a certificate →- Q1. What does this print? (code)
- Q2. What is the worst-case time complexity of merge sort?
- Q3. When does quick sort with "last element as pivot" take O(n²)?
- Q4. After a partition step of quick sort, what is guaranteed about the pivot?
- Q5. Which sort is stable?
- Q6. How much extra memory does merge sort on an array need?
- Q7. Which simple change protects quick sort from its worst case on sorted input?
- Q8. You need the 3rd smallest of 10⁶ numbers, as fast as possible on average. Which idea fits?
- Q9. What does this print? (code)
- Q10. Merge sort splits 16 items in half again and again. How many levels of splitting until every part has 1 item?
- Q11. In the merge step, why use a[i] <= b[j] rather than a[i] < b[j]?
- Q12. What is the average-case time of quick sort with a random pivot?
- Q13. What does quickselect do differently from quick sort?