GoalSay what an algorithm is and why the order of steps matters.
New words
algorithm · a list of steps in the right order that explains how to do a taskstep · one small part of a taskorder · which step comes first and which comes nexttask · a job we want to get done
Explanation
An algorithm is a list of steps, in the right order, that explains how to do a task. Order matters: if you put on your shoes before your socks, the job goes wrong. Algorithms are everywhere. A good algorithm has clear steps, not too many and not too few, and it works every time. Here is an algorithm for a cheese-and-tomato sandwich: wash your hands, put the bread on a plate, open the bread, add slices of cheese and tomato (a grown-up cuts the tomato), close the bread. Change the order and the sandwich fails: you cannot add cheese after the bread is closed!
Wash hands→Bread on a plate→Open the bread→Add cheese and tomato→Close the bread
Worked examples
Socks first, then shoes. If we swap the order, the sock cannot go on over the shoe.
An algorithm for watering a plant: fill a jug with water, carry it to the plant, pour slowly until the soil is damp, then put the jug back.
Mariam wrote: “Close the bread. Add cheese. Open the bread.” This order is wrong, so where does the cheese go? The right order: open the bread, add the cheese, close the bread.
Class activity
A human algorithm. Write the steps for “draw a house on paper”: draw a square, draw a triangle on top for the roof, add a door, add windows. Cut the steps into strips, mix them up, and let a partner put them in order. Then swap in a wrong strip to see what happens.
Practice
1
What is an algorithm?
A list of steps in the right order that explains how to do a task.
2
Why does order matter? Give an example.
Because changing the order can spoil the task, such as putting on shoes before socks.
3
Put the steps for washing hands in order.
B, A, C, D.
4
A step is missing in: “Put the bread on a plate. Close the bread.” What is missing?
Opening the bread and adding the cheese and tomato.