Reading & writing · Grades 8–10
The sorting shortcut
Read once, answer together, and check your reasoning.
The sorting shortcut
A library app sorts titles quickly by using the first three letters only. Tests with a small sample look successful. When the full catalogue is loaded, titles beginning with the same three letters appear in inconsistent order. The developer realizes the shortcut checked only a prefix, not the entire title. A new test set includes many shared prefixes and different letter cases.
Try it yourself
What assumption caused the shortcut to fail?
Why did the small initial test set miss the defect?
What new cases are added to testing?
What does this suggest about testing only easy examples?
Check your understanding
Answers and marking notes
- That the first three letters were sufficient to determine the full intended ordering.
That the first three letters were sufficient to determine the full intended ordering.
- It may not have included enough titles sharing prefixes or other important edge cases.
It may not have included enough titles sharing prefixes or other important edge cases.
- Titles with shared prefixes and different letter cases.
Titles with shared prefixes and different letter cases.
- Passing easy or narrow examples does not establish correctness across the real input range.
Passing easy or narrow examples does not establish correctness across the real input range.
Learning preview · teacher review required. Grade bands are approximate, not official curriculum alignment.