← Quiz: Counting Sort and Custom Sorting: all 13 questions
Quiz: Counting Sort and Custom Sorting · Question 10 of 13
You sort students by name, then sort the result by marks using a stable sort. What happens to students with equal marks?
You sort students by name, then sort the result by marks using a stable sort. What happens to students with equal marks?
- A.They end up in random order
- B.They are sorted by marks only, with names reversed
- C.They stay in name order, because a stable sort keeps the order of equal keys
- D.The second sort fails
Answer & explanation
Correct answer: They stay in name order, because a stable sort keeps the order of equal keys
This is how you sort by several keys in steps: least important key first.
Can you get the rest right without peeking?
Take the timed Quiz: Counting Sort and Custom Sorting quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →