Recall & Review
beginner
What does it mean for a sorting algorithm to be stable?
A stable sorting algorithm keeps the original order of equal elements the same after sorting.
Click to reveal answer
beginner
Name a common stable sorting algorithm.
Merge Sort is a common stable sorting algorithm.
Click to reveal answer
intermediate
Why might you choose a stable sort over an unstable sort?
You choose a stable sort when you want to keep the relative order of equal elements, for example, when sorting by multiple keys step-by-step.
Click to reveal answer
intermediate
Which sorting algorithm is generally fastest for small arrays and why?
Insertion Sort is generally fastest for small arrays because it has low overhead and works well when the array is nearly sorted.
Click to reveal answer
intermediate
When should you prefer Quick Sort over Merge Sort?
Prefer Quick Sort when you want an in-place sort with good average performance and less memory use, but be aware it is not stable.
Click to reveal answer
Which of these sorting algorithms is stable?
✗ Incorrect
Merge Sort is stable because it preserves the order of equal elements during merging.
Why is Insertion Sort preferred for small or nearly sorted arrays?
✗ Incorrect
Insertion Sort is simple and efficient for small or nearly sorted arrays because it minimizes comparisons and swaps.
Which sorting algorithm is NOT stable?
✗ Incorrect
Quick Sort is generally not stable because it swaps elements without preserving order of equal keys.
When sorting large data that does not fit in memory, which algorithm is preferred?
✗ Incorrect
Merge Sort is preferred for large data and external sorting because it can be implemented to work with data on disk.
Which sorting algorithm uses divide and conquer and is stable?
✗ Incorrect
Merge Sort uses divide and conquer and is stable.
Explain what sorting stability means and give an example of when it matters.
Think about sorting a list of people first by age, then by name.
You got /3 concepts.
Describe when you would choose Quick Sort, Merge Sort, or Insertion Sort.
Consider memory use, stability, and data size.
You got /3 concepts.