🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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 →
  1. Q1. What does this print? (code)
  2. Q2. What is the worst-case time complexity of merge sort?
  3. Q3. When does quick sort with "last element as pivot" take O(n²)?
  4. Q4. After a partition step of quick sort, what is guaranteed about the pivot?
  5. Q5. Which sort is stable?
  6. Q6. How much extra memory does merge sort on an array need?
  7. Q7. Which simple change protects quick sort from its worst case on sorted input?
  8. Q8. You need the 3rd smallest of 10⁶ numbers, as fast as possible on average. Which idea fits?
  9. Q9. What does this print? (code)
  10. Q10. Merge sort splits 16 items in half again and again. How many levels of splitting until every part has 1 item?
  11. Q11. In the merge step, why use a[i] <= b[j] rather than a[i] < b[j]?
  12. Q12. What is the average-case time of quick sort with a random pivot?
  13. Q13. What does quickselect do differently from quick sort?