← Quiz: Counting Sort and Custom Sorting: all 13 questions
Quiz: Counting Sort and Custom Sorting · Question 4 of 13
A stable sort orders [("A", 2), ("B", 1), ("C", 2)] by the number. What is the result?
A stable sort orders [("A", 2), ("B", 1), ("C", 2)] by the number. What is the result?
- A.[("B", 1), ("A", 2), ("C", 2)]
- B.[("B", 1), ("C", 2), ("A", 2)]
- C.[("A", 2), ("C", 2), ("B", 1)]
- D.It depends on the computer
Answer & explanation
Correct answer: [("B", 1), ("A", 2), ("C", 2)]
A and C both have 2; a stable sort keeps A before C as in the input.
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 →