You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
An algorithm is a step-by-step set of instructions designed to perform a specific task or solve a particular problem. Algorithms are at the heart of every computer program, but they are not limited to computing — you follow algorithms every day, from recipes to morning routines.
Computers cannot think for themselves. They require precise, unambiguous instructions to carry out any task. An algorithm provides those instructions. Before writing any code, a programmer must first design an algorithm that clearly describes:
If the algorithm is wrong, the program will be wrong — no matter how well the code is written. This is why algorithm design is one of the most important skills in Computer Science.
A well-designed algorithm should have the following properties:
| Property | Meaning |
|---|---|
| Finite | It must eventually stop — it cannot run forever |
| Definite | Each step must be clear and unambiguous |
| Effective | Each step must be achievable (computable) |
| Has inputs | It takes zero or more inputs |
| Has outputs | It produces at least one output |
Exam Tip: If you are asked to describe what makes a good algorithm, remember these five properties. AQA and OCR mark schemes often award marks for mentioning that an algorithm must terminate and that each step must be unambiguous.
There are three main ways to represent an algorithm at GCSE level:
Writing the steps in plain English. This is easy to understand but can be ambiguous.
Example — Making a cup of tea:
A way of writing algorithms that looks like code but is not tied to any particular programming language. It uses keywords like IF, THEN, ELSE, WHILE, FOR, REPEAT, UNTIL, INPUT, OUTPUT.
Example — Check if a number is positive:
INPUT number
IF number > 0 THEN
OUTPUT "Positive"
ELSE IF number < 0 THEN
OUTPUT "Negative"
ELSE
OUTPUT "Zero"
ENDIF
A diagrammatic way of representing an algorithm using standard symbols:
| Symbol | Shape | Purpose |
|---|---|---|
| Terminator | Rounded rectangle (oval) | Start or end of the algorithm |
| Process | Rectangle | An instruction or action |
| Decision | Diamond | A yes/no question (branch) |
| Input/Output | Parallelogram | Taking input or producing output |
| Arrow | Line with arrowhead | Shows the flow of control |
Exam Tip: In the exam, always label your flowchart arrows clearly and make sure every decision box has exactly two exits — one for YES and one for NO.
Two key techniques are used when designing algorithms:
Breaking a complex problem down into smaller, more manageable sub-problems. Each sub-problem can then be solved individually.
Example: Building a game might be decomposed into:
Removing unnecessary detail and focusing only on what is important for solving the problem. This simplifies the problem without losing essential information.
Example: A map of the London Underground is an abstraction — it shows stations and connections but removes the actual geographic distances and street layouts.
Algorithms are not just for computers. Many everyday tasks follow algorithmic thinking:
Understanding algorithms helps you think logically and systematically, which is a core skill for GCSE Computer Science.
| Term | Definition |
|---|---|
| Algorithm | A step-by-step set of instructions to solve a problem |
| Pseudocode | A language-independent way of writing algorithms |
| Flowchart | A diagram representing an algorithm using standard symbols |
| Decomposition | Breaking a problem into smaller sub-problems |
| Abstraction | Removing unnecessary detail to simplify a problem |
| Sequence | Steps carried out one after another in order |
| Selection | A decision point (IF/ELSE) |
| Iteration | Repeating steps (loops) |