You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
Algorithmic thinking is one of the four pillars of computational thinking. It involves designing a clear, step-by-step solution (an algorithm) to solve a problem. An algorithm is a precise set of instructions that, when followed, will produce the correct output for any valid input. Algorithmic thinking is central to GCSE Computer Science — you must be able to design, interpret, and evaluate algorithms.
An algorithm is a finite sequence of well-defined instructions that solves a specific problem or performs a specific task. Algorithms have several key properties:
Algorithms are not limited to computers. Everyday examples include:
However, in computer science, algorithms must be precise enough for a computer to follow. A computer cannot interpret vague instructions like "add a pinch of salt" — it needs exact values and conditions.
When designing an algorithm, follow these steps:
Problem: Given a list of numbers, find the largest one.
Inputs: A list of numbers Output: The largest number in the list
Algorithm in pseudocode:
max ← list[0]
FOR i ← 1 TO LENGTH(list) - 1
IF list[i] > max THEN
max ← list[i]
END IF
END FOR
OUTPUT max
Trace table for the list [3, 7, 2, 9, 4]:
| Step | i | list[i] | max | Condition (list[i] > max) |
|---|---|---|---|---|
| Init | — | — | 3 | — |
| 1 | 1 | 7 | 7 | TRUE |
| 2 | 2 | 2 | 7 | FALSE |
| 3 | 3 | 9 | 9 | TRUE |
| 4 | 4 | 4 | 9 | FALSE |
Output: 9
The full design loop — from problem to trace — looks like this:
graph LR
P["Problem<br/>Find largest<br/>in a list"] --> A["Algorithm<br/>Initialise max,<br/>loop, compare,<br/>update"]
A --> C["Code/Pseudocode<br/>FOR i ... IF ..."]
C --> T["Trace table<br/>step through<br/>each iteration"]
T -->|verify| OK["Correct output"]
T -.->|bug found| A
All algorithms are built from three fundamental constructs:
Instructions are executed one after another, in order:
INPUT radius
area ← 3.14159 * radius * radius
OUTPUT area
The program chooses which instructions to execute based on a condition:
INPUT age
IF age >= 18 THEN
OUTPUT "You can vote"
ELSE
OUTPUT "You cannot vote yet"
END IF
Selection can also use nested IF statements or CASE/SWITCH statements for multiple conditions.
Instructions are repeated either a set number of times or until a condition is met:
FOR i ← 1 TO 10
OUTPUT i * i
END FOR
password ← ""
WHILE password ≠ "secret123"
INPUT password
END WHILE
OUTPUT "Access granted"
REPEAT
INPUT number
UNTIL number >= 0
Exam Tip: You must know the difference between WHILE and REPEAT...UNTIL loops. A WHILE loop checks the condition before each iteration (and may not execute at all). A REPEAT...UNTIL loop checks the condition after each iteration (and always executes at least once).
A trace table is used to track the values of variables as an algorithm executes. It is a vital tool for:
count ← 0
FOR i ← 1 TO 5
IF i MOD 2 = 0 THEN
count ← count + 1
END IF
END FOR
OUTPUT count
| Step | i | i MOD 2 | Condition | count |
|---|---|---|---|---|
| Init | — | — | — | 0 |
| 1 | 1 | 1 | FALSE | 0 |
| 2 | 2 | 0 | TRUE | 1 |
| 3 | 3 | 1 | FALSE | 1 |
| 4 | 4 | 0 | TRUE | 2 |
| 5 | 5 | 1 | FALSE | 2 |
Output: 2 (there are 2 even numbers between 1 and 5)
Not all algorithms that solve the same problem are equally good. Algorithm efficiency considers:
For GCSE, you should understand that:
Algorithmic thinking is about designing clear, step-by-step solutions. All algorithms use sequence, selection, and iteration. You should be able to write algorithms in pseudocode, trace them using trace tables, and evaluate their efficiency. Algorithmic thinking is assessed throughout the GCSE Computer Science exam.
Algorithmic thinking is the culmination of the four computational-thinking pillars. By the time you are writing an algorithm, you have already decomposed the problem, abstracted the data, spotted the patterns and decided which programming constructs to use. This section deepens each of those steps with worked examples — a quiz marker and a traffic-light controller — and ends with grade-banded model answers.
A good GCSE algorithm has five named parts:
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.