Thinking in Steps
What is an algorithm?
Follow an algorithm step by step to find what it produces, and explain why changing the order of the steps changes the answer.
An algorithm is a set of clear steps, written in order, that finishes a job. You already follow them every day: a recipe is an algorithm, so are the directions to a friend's house, and so is the long-multiplication method you were taught in maths. Nothing about an algorithm needs a computer — a computer is just something that will follow one very fast and never get bored.
Three things every algorithm needs
Each step must be clear enough that there is nothing to guess. The steps must be in an order, because doing them in a different order usually gives a different answer. And it must end — a set of steps that goes round for ever never produces anything.
Worked example
Follow this algorithm: start with 5, then add 1, then double it.
Start with 5. Write it down.
Always write down what you are holding after each step, or you will lose track by the third one.
Try it together
Now follow this one: start with 9, then take away 4, then multiply it by 3.
Answer with the number you are holding after each step.
1.Start with 9 and take away 4. What are you holding now?
Have a go
Have a go on your own. An algorithm says: start with 6, then double it, then take away 5. What number do you end with?
Ready to practise?
Eight questions on what you have just read. Nothing is timed, and you can play as many times as you like.