Skip to content

Algorithms

Algorithms, explained so they make sense

Searching, sorting, pseudocode and trace tables, taught step by step. Picture it first, then write it, then answer the exam question with confidence.

A learner working through an algorithm on paper

What an algorithm is

An algorithm is a precise set of steps that solves a problem. A recipe is an algorithm. So is the route you follow to school. In Computer Science, the steps have to be exact enough that a computer could follow them without guessing.

At GCSE you need to read algorithms, write them in pseudocode or a programming language, trace them, find and fix errors, and compare how efficient they are.

Computational thinking

Every algorithm question builds on three skills:

  • Decomposition: breaking a problem into smaller parts you can solve one at a time.
  • Abstraction: removing detail that does not matter, so you can focus on what does.
  • Algorithmic thinking: putting the steps in the right order, with the right decisions and repetition.

The three building blocks

Every algorithm, however long, is built from three structures.

Sequence

Steps run one after another, in order.

Selection

A decision: IF something is true, do one thing, ELSE do another.

Iteration

Repetition: a FOR loop runs a set number of times, a WHILE loop runs until a condition changes.

Searching: linear search

A linear search checks each item in turn, from the start, until it finds the target or reaches the end. It works on any list, sorted or not, but it can be slow on a long list.

Try it below. Each step compares one item with the target.

Trace tables

A trace table records the value of each variable as an algorithm runs, one row at a time. It is one of the most common exam questions, and one of the easiest to get full marks on once you have a method.

total ← 0
FOR i ← 1 TO 4
  total ← total + i
ENDFOR
OUTPUT total
itotalOutput
–0
11
23
36
410
10
  1. Write one column for every variable, plus one for output.
  2. Work through the code line by line. Only write a value when it changes.
  3. Check the loop's start and end values carefully. Most lost marks are off by one.

Sorting

You need to know how bubble sort, merge sort and insertion sort work, trace them on a short list, and compare them. The GCSE Algorithm Cheat Sheet has each one step by step, with an interactive bubble sort and binary search.

How Dee teaches algorithms

  • Every algorithm is shown visually before any pseudocode.
  • Real exam-style questions in every session, using your exam board's notation.
  • Mark scheme thinking: what earns marks and what loses them.
  • The same idea practised with different questions until it sticks.

Questions

Common questions

Do I need to memorise the algorithms?

You need to understand how each one works well enough to trace it, explain it and spot it in code. Understanding lasts longer under exam pressure than memorising.

Which pseudocode should I use?

Use the style your exam board uses. AQA publishes its own pseudo-code and OCR uses its Exam Reference Language. See the GCSE Pseudocode Guide.

Can Dee help with algorithms one to one?

Yes. GCSE Computer Science lessons are £60 an hour, online and one to one.

Want help with this one to one?

Dee replies personally to every enquiry, usually within two working days.

Send an enquiry