An algorithm is a fancy word for a simple idea: a set of steps that tell you how to do a job, one bit at a time, in the right order.
Steps in the right order
Think about making a jam sandwich. The order of the steps really matters — you cannot put the jam on before you have the bread!
Put these steps in order to make a jam sandwich:
- Take two slices of bread
- Open the jam jar
- Spread jam on one slice
- Put the other slice on top
Swap the last two steps and you would spread jam on a slice with nothing under it. Silly! The order is part of the algorithm.
Be exact
A computer follows your words very carefully. If you say "put jam on the bread" but do not say how much or which slice, a computer would not know what to do. Good steps are exact.
| Woolly step | Exact step |
|---|---|
| Get ready | Put on your shoes |
| Clean up | Put the toys in the box |
| Go to school | Walk to the front door, then turn left |
Everyday algorithms
You follow algorithms all the time without knowing it: brushing your teeth, tidying your room, following a treasure-hunt map. Each one is a set of steps in an order.