Sorting & Ordering
Sorting means putting things into groups by a rule. Ordering means arranging things from first to last!
Putting Things in Groups
Sorting means putting things that are alike together. You already sort things every day!
🧦
Socks go in the sock drawer.
🍴
Forks go with forks.
📚
Books go on the bookshelf.
We sort things by a rule. The rule tells us which group each thing belongs to.
Sorting by Different Rules
You can sort the same things in different ways! The rule you choose changes the groups you get.
Imagine you have toy animals. You could sort them in different ways:
Sort by Colour
Brown animals in one group. White animals in another. Grey animals in another.
Sort by Size
Big animals in one group. Small animals in another.
Sort by Type
Farm animals in one group. Wild animals in another. Pet animals in another.
Same toys, different rules, different groups! The rule you pick changes how things are sorted.
Putting Things in Order
Ordering is a special kind of sorting. When you put things in order, there is a first and a last.
🐝 🐱 🐘
Smallest to Biggest
Mouse, cat, elephant
A B C
A to Z
Alphabetical order
1 2 3
1 to 100
Number order
Why Computers Need Sorting
When you search for a name in a list, the computer sorts it A to Z so it can find things quickly.
Without sorting, the computer would have to check every single item! That would take a very long time.
Without Sorting
Tom, Alice, Zara, Ben, Mia... The computer checks every name one by one. Slow!
With Sorting (A-Z)
Alice, Ben, Mia, Tom, Zara... The computer jumps straight to the right spot. Fast!
Sorting helps computers find things quickly. That is why sorting is so important in coding!
Think About It
1. How would you sort a pile of LEGO bricks? Can you think of two different rules?
2. If your books were in no order, would it be easy to find one? Why?
3. Can you put these in order from smallest to biggest: elephant, mouse, cat?
Knowledge Check
Choose the correct answer for each question. Click "Check Answer" to see if you are right!
Question 1
Sorting means...
Question 2
You have red, blue, and green blocks. If you sort by colour, how many groups do you get?
Question 3
Which list is in order from smallest to biggest?
Question 4
Why do computers sort information?
Question 5
Putting names in A-Z order is called...
Key Concepts Summary
- ●Sorting means grouping things by a rule.
- ●You can sort the same things in different ways by changing the rule.
- ●Ordering means arranging from first to last (e.g. smallest to biggest, A to Z).
- ●Computers sort information so they can find things quickly.