Algorithms: clear instructions — Computing, 7–10 years
An algorithm is a plan made from steps that a person or computer can follow. You will make one, test it and notice why the order of steps matters.
What is an algorithm?
An algorithm is a set of steps for reaching a result. A recipe, directions to a friend’s house or rules for a game can all be algorithms. The steps need to be clear enough that someone else can use them without guessing.
Why do we need them?
Computers do not fill in missing details as people often do. They need instructions that can be repeated in the same way, even when nobody is watching. Algorithms grew from the need to solve problems reliably, not from a wish to make rules for their own sake.
Example: brushing teeth
Make a plan: 1, put toothpaste on the brush; 2, wet the brush; 3, brush the outside, inside and tops of the teeth for two minutes; 4, spit and rinse. Putting toothpaste on after brushing would not give the same result, so order matters.
The trap: vague words
A common mistake is writing “move forward” or “make it nice” without saying how far or what nice means. This is reasonable because people use context and gestures to help each other. A computer cannot see that context, so replace vague words with actions you can check.
Where does it appear?
Algorithms help a map app choose a route, a washing machine run its programme and a search engine order results. In each case, the computer follows a plan with information and rules. The plan may be complex, but it is still made from steps.
Keep exploring
Other languages
Loading MyLeoNes™…