Sorting information — Computing, 7–10 years
Sorting puts information into an order that helps people and computers use it. Alphabetical, numerical and date orders each help with different jobs.
Putting things in a useful order
Sorting means arranging items according to a rule, such as name from A to Z, number from small to large or date from old to new. The items do not change; only their order changes. A useful order makes a list easier to scan and use.
Why sort a list?
An unsorted list forces you to inspect items in a random-looking order. People began arranging records so names, prices or dates could be checked more quickly, and computers made this practical for thousands of items. Sorting does not find an answer by itself, but it creates a clearer path.
Sorting four scores
Take the scores 8, 3, 6 and 10. For smallest to largest, compare nearby values and move 3 before 8: 3, 8, 6, 10. Move 6 before 8: 3, 6, 8, 10. Finally, check each pair from left to right; every number is now no smaller than the one before it.
The trap: sorting text like numbers
A common mistake is thinking that 12 must come before 3 because 1 comes before 3. A computer may compare the first characters as text, producing 1, 12, 3, 30. This is reasonable because the symbols look the same; you must tell the program whether they mean words or numerical values.
Where it helps
A music app can sort songs by title, artist or length. A shop can order products by price, and a calendar can show events from earliest to latest. The best order depends on the question you are trying to answer.
Keep exploring
Other languages
Loading MyLeoNes™…