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 an unstable sort like Quick Sort over a stable sort?
Quick Sort is often faster and uses less memory, so it is chosen when speed and space are more important than keeping equal elements in order.
Click to reveal answer
beginner
Which sorting algorithm is best for nearly sorted data and why?
Insertion Sort is best for nearly sorted data because it runs very fast when the list is almost sorted.
Click to reveal answer
intermediate
What is a key factor in deciding which sorting algorithm to use?
Key factors include data size, whether stability is needed, memory limits, and if the data is nearly sorted or random.
Click to reveal answer
Which sorting algorithm is stable by default?
✗ Incorrect
Merge Sort keeps equal elements in their original order, making it stable.
When is Insertion Sort a good choice?
✗ Incorrect
Insertion Sort is efficient for nearly sorted data because it requires fewer moves.
Why might Quick Sort be preferred over Merge Sort?
✗ Incorrect
Quick Sort usually uses less memory and can be faster, but it is unstable.
What does an unstable sort do with equal elements?
✗ Incorrect
Unstable sorts can reorder equal elements differently from their original order.
Which factor is NOT important when choosing a sorting algorithm?
✗ Incorrect
The color of data is irrelevant; size, stability, and memory are important.
Explain what sorting stability means and give an example of when you would need a stable sort.
Think about keeping order of equal items.
You got /3 concepts.
Describe how you would choose a sorting algorithm based on data size, stability needs, and data order.
Match algorithm strengths to data conditions.
You got /4 concepts.