← Back to course
Code Crew G3 / Week 07 / Tuesday
2/6
Week 07 Β· Algorithms

Tuesday

// Best way to solve it

Tuesday: Sort the Crew

Six friends want to line up for a photo. "Line up by height!" Rocket calls. Everyone moves at once, and the line is a jumble.

Raven raises her hand. "What do you notice? We need a plan, one step at a time."

Nova hovers above the line. "Here is a hint. Compare two heights at a time." Let's help them sort the friends from shortest to tallest.

Below are 6 friends with their heights. Put them in order from SHORTEST (1) to TALLEST (6).

SORT BY HEIGHT (CM)
  • ?Bea: 124 cm
  • ?Sami: 137 cm
  • ?Theo: 141 cm
  • ?Ada: 128 cm
  • ?Liam: 132 cm
  • ?Mia: 119 cm
WHY THIS EXERCISEMany sorting methods compare two items at a time. You do the same thing in your head: 'is 119 smaller than 132? Yes, Mia goes first.'

Sorting Tricks

To sort a long list, try pick the smallest. Find the smallest, set it aside, and repeat.

SORT THE CREW
  • Read the question.
  • Tap your answer.
Heights: 132, 119, 141. Which is the shortest?
Heights: 128, 137, 124. Which is the tallest?
After you pick the shortest, what do you do next?
Six friends stand in order. How many friends stand before the tallest?
Sort 141, 119, 132. Which number is in the middle?
Sort the words cat, ant, bee in ABC order. Which word is first?
Same words. Which word is last?
StatementTrue or false?
Pick the smallest repeats until no cards are left.?
Shortest to tallest puts the shortest person first.?
You can sort numbers, but never words.?
A sorted list makes it easier to find things.?
WHY THIS EXERCISESorting helps people and computers find things fast.
Try it
Line up three stuffed animals from shortest to tallest.
Use the pick the smallest plan.
Count how many times you looked for the smallest.
β—‡ PARTNER MOVE
How did you sort them? Out loud, describe your steps.
That description is your ALGORITHM.
← Monday