What Is an Algorithm?

Discover that an algorithm is simply a careful set of instructions, like a recipe.

  • Define and explain What Is an Algorithm? in your own words
  • Use key terms such as algorithm accurately
  • Apply what you have learned to new examples and questions
  • Avoid the common mistakes learners make with this topic

Computers cannot think for themselves — they only follow instructions. Before you ever touch a keyboard, you can learn the most important skill in computing: giving instructions so clear that even a robot could follow them. This chapter is all about algorithms you can act out with your body, no computer needed.

This lesson focuses on What Is an Algorithm?: discover that an algorithm is simply a careful set of instructions, like a recipe.

Definition: What Is an Algorithm?

Discover that an algorithm is simply a careful set of instructions, like a recipe.

Key ideas

Order matters

Instructions must be given in the right sequence. If a recipe told you to ice the cake before baking it, you would get a mess. Algorithms work the same way: each step builds on the ones before it, so a computer follows them exactly in the order written.

Be specific

Humans are good at filling in gaps, but computers are not. Telling a robot to 'make a sandwich' is useless; you must say 'pick up the bread', 'spread the butter' and so on. Writing algorithms trains you to notice every small step you normally do without thinking.

Key term — algorithm: A precise, step-by-step set of instructions for completing a task or solving a problem, like a recipe for a cake.

The Jam Sandwich Robot

Give instructions so precise that a 'robot' (your teacher) can make a jam sandwich without making a mess.

Say 'Pick up one slice of bread with your left hand' — vague orders like 'get the bread' let the robot grab the whole loaf. Say 'Pick up the butter knife with your right hand' — the robot must know exactly which tool to use. Say 'Spread butter on one side of the slice' — if you skip 'one side', the robot may butter both. Say 'Put one spoonful of jam on the buttered side' — a measurement stops the robot from using the whole jar. Say 'Place the second slice on top' — now the sandwich is finished and tidy.

Answer: A complete algorithm: pick up one slice of bread, pick up the knife, spread butter on one side, add one spoonful of jam, and place the second slice on top. Every step names the exact action, the tool and the amount — nothing is left to guess.

Common mistakes
  • Instructions are too vague Correction: name the exact object, action and amount in every step — 'pick up the red cup' beats 'get that thing'.
  • Missing a step Correction: watch someone follow your instructions literally, and add any step they had to guess.

Practice

True or false: an algorithm must always be written for a computer.
Think about recipes and dance routines.

False — recipes, knitting patterns and dance routines are all algorithms, and none of them needs a computer.

Why would a robot fail if you told it to 'tidy your bedroom'?
Think about how many smaller jobs 'tidy' hides.

The instruction is too vague — the robot cannot guess what tidy means, so you must break it into exact steps like 'pick up the books and put them on the shelf'.

Give two reasons why 'draw a cat' is a poor instruction for a robot.
What would the robot need to know that you have not said?

It does not say what to draw with or on, nor what the cat should look like — the robot would have to guess the tool, the size and every detail.

Put these steps for brushing your teeth in the right order: (a) rinse your mouth, (b) put toothpaste on the brush, (c) brush for two minutes.
Which step must come before the brush can do its job?

(b), then (c), then (a).

Quick check

What Is an Algorithm? — quick check

Which of these best defines "algorithm"?

A precise, step-by-step set of instructions for completing a task or solving a problem, like a recipe for a cake.

Write the missing step: 1. Open the tap. 2. ___. 3. Turn off the tap.

2. Fill the glass with water (or wash your hands).

Spot the bug: 1. Put bread in the toaster. 2. Plug in the toaster. 3. Push the lever down.

Steps 1 and 2 are in the wrong order — plug the toaster in before pushing the lever, or nothing will heat up.
Key takeaways
  • What Is an Algorithm?: discover that an algorithm is simply a careful set of instructions, like a recipe.
  • Order matters: Instructions must be given in the right sequence.
  • sequence: The order in which instructions are carried out.
  • Watch out for: instructions are too vague