Computer Science I / Sorting Strategies
Practice question · True or false

Sorting stability only matters when the records carry information beyond the key being sorted on.

Hints
  1. What would two equal keys differ in?
  2. If the records are identical, order between them is unobservable.
Show the answer

True

Why

True. Stability preserves the relative order of equal keys, which is observable only if those records differ in some other field. It is what makes multi-pass sorting work: sort by name, then stably by department, and equal departments stay in name order. Sorting bare integers, stability is undetectable.

Read the lesson: Sorting Strategies →

Practise Sorting Strategies

The app has 5 more questions on this lesson, and keeps your place in the course. Computer Science I is free to start.

More questions on Sorting Strategies