GoalUse logical thinking to break a job into steps and put the steps in an order that works.
New words
logical thinking · working out a problem so that every step makes sensebreak down · to split a big job into small piecesorder · which step comes first, which comes next and which comes last
Explanation
We write an algorithm to solve a problem or do a job. Logical thinking helps us to write a good one. First, understand the problem. Next, break the job down into small pieces. Then think about the steps each piece needs. Last, put the steps in an order that makes sense. Some steps must come before others. You cannot water a seed before the soil is in the pot. Ask yourself: “Can I do this step yet?”
Step
Instruction
1
Put soil in the pot
2
Push a bean seed into the soil
3
Pour in a little water
4
Put the pot next to a sunny window
Worked examples
Step
Instruction
1
Get the fruit
2
Wash the fruit
3
Cut the fruit with an adult
4
Put the pieces in a bowl
5
Mix and serve
Nodira breaks down “make a fruit salad” into pieces: get the fruit, wash it, cut it (an adult helps with the knife), put it in a bowl and mix. She puts the pieces in order. Washing comes before cutting, and the bowl comes before mixing.
Some steps can swap and some cannot. To send a postcard, writing the message and writing the address can swap. The stamp must be on before the card is posted, and posting is always last.
Step
Instruction
1
Put on an apron
2
Wash the brush
3
Paint the picture
When the order is wrong, the result is wrong. This painting algorithm has a mistake: the brush is washed before any painting is done. Painting must come before washing the brush.
Class activity
Cut-up steps (in groups): write the steps for making a cold sandwich on separate strips of paper: wash hands, take two slices of bread, spread butter on one slice, add the filling, put the slices together, put the sandwich on a plate. Mix the strips up. Another group puts them in order, using logical thinking. Ask: which two strips could swap? Which one must always come first? Then swap jobs with another group and try a new task, such as “draw a house”.
Practice
1
Put these steps in order for washing a bicycle: (a) dry it with a cloth (b) rinse it with water (c) scrub it with a soapy sponge (d) fill a bucket with soapy water.
d, c, b, a. You need the soapy water before you scrub, and you dry it last.
2
Break the job “draw a flower” into four pieces.
For example: draw the middle, draw the petals, draw the stem and leaves, colour it in.
3
Which step is in the wrong place? How should the algorithm be fixed?
Step
Instruction
1
Pour water on the plant
2
Fill the can with water
3
Carry the can to the plant
Step 1 is in the wrong place. The can must be filled first. Correct order: fill the can, carry it to the plant, pour the water.
4
Which two steps can swap places without changing the result? Which step must stay first, and which must stay last?
Step
Instruction
1
Put a cloth on the table
2
Put out the forks
3
Put out the spoons
4
Call everyone to eat
The forks and the spoons can swap. The cloth must stay first, because the forks and spoons go on top of it. Calling everyone must stay last.