An algorithm is a precise, step-by-step set of instructions designed to solve a problem or complete a task. Every algorithm must have a clear start and end point, and must always produce a result when given a valid input.
The Edexcel 4CP0 specification requires you to be able to interpret given algorithms (work out what they do) and create your own algorithms to solve stated problems.
A well-designed algorithm must have all of the following properties:
All algorithms are built from three fundamental constructs:
| Construct | Description | Example |
|---|---|---|
| Sequence | Steps executed one after another in order | Input name, then print greeting |
| Selection | A decision is made; different paths taken based on a condition | IF score ≥ 50 THEN pass ELSE fail |
| Iteration | Steps repeated while a condition is true or a set number of times | Loop through all items in a list |
To interpret an algorithm, read each step carefully and trace what happens to variables as the algorithm runs. Follow any conditions and loops exactly — do not skip steps.
Example: Interpret what the following algorithm does when x = 10:
This algorithm calculates the sum of integers from 1 to x (i.e. 1+2+3…+10 = 55).
When writing your own algorithm, follow these steps:
Algorithms can be expressed as written steps, flowcharts, or pseudocode — all three are valid representations.
Answer each question then click Submit for marking against the Edexcel mark scheme.
C > A instead of C > largest (1)SET total TO 0
FOR count FROM 1 TO 5
RECEIVE num FROM KEYBOARD
SET total TO total + num
NEXT count
SEND total TO DISPLAY| Term | Definition |
|---|---|
| Algorithm | A precise, finite set of step-by-step instructions used to solve a problem or complete a task |
| Sequence | Steps executed one after another in a fixed order |
| Selection | A decision point in an algorithm where different paths are taken based on a condition (IF/THEN/ELSE) |
| Iteration | Repeating a set of steps a number of times or while a condition holds true (loops) |
| Input | Data supplied to an algorithm for processing |
| Output | The result produced by an algorithm after processing inputs |
| Finite | An algorithm that is guaranteed to terminate after a limited number of steps |
| Unambiguous | Each step of the algorithm has exactly one clear meaning — no room for interpretation |
Test your understanding of algorithms — Edexcel 4CP0 style questions with a time limit.