Open the app
  1. Home
  2. Lessons
  3. GCSE & IGCSE Computer Science
  4. What is an algorithm?

What is an algorithm?

🎬 The doodle video for this lesson is coming soon. Subscribe on YouTube to see it first.

At KS3 you met algorithms as sets of instructions. GCSE Computer Science expects you to read, follow and write them precisely.

Algorithms

An algorithm is a precise, step-by-step set of instructions for solving a problem or completing a task.
A good algorithm is unambiguous (each step has one meaning), the steps are in the right order, and it finishes.
A recipe and the directions to a friend's house are everyday algorithms. A program is an algorithm written in a programming language.

Ways to show an algorithm

You can show the same algorithm as:
Written description: numbered steps in plain English.
Flowchart: shapes joined by arrows.
Pseudocode: structured, code-like English that is not tied to one language.
Program code: for example Python, which a computer can run.

Flowchart symbols

Learn these five. They come up again and again.
Worked example

Follow this algorithm with the number 7.
1. Take a number.
2. Double it.
3. Add 4.
4. Halve the result.
5. Output the answer.

  1. Double 7: 7 × 2 = 14
  2. Add 4: 14 + 4 = 18
  3. Halve: 18 ÷ 2 = 9

Answer: 9

Key idea

An algorithm is a precise, ordered set of steps that finishes. It can be shown as a written description, a flowchart, pseudocode or code. Flowcharts: rounded rectangle start/stop, rectangle process, diamond decision, parallelogram input/output.

The interactive lesson includes the diagrams for this topic.

Check you have got it

Answer 6 quick questions with instant marking. If you get one wrong, GCSE-ready shows you why and gives you another go. It is free, and you do not need an account.