Skip to content

You are viewing a free preview of this lesson.

Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.

What is an Algorithm

What is an Algorithm

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.


Why Algorithms Matter in Computer Science

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:

  • What inputs are needed
  • What steps to follow (in order)
  • What output should be produced

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.


Properties of a Good Algorithm

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.


Representing Algorithms

There are three main ways to represent an algorithm at GCSE level:

1. Natural Language (Structured English)

Writing the steps in plain English. This is easy to understand but can be ambiguous.

Example — Making a cup of tea:

  1. Fill the kettle with water
  2. Boil the kettle
  3. Place a tea bag in a cup
  4. Pour boiling water into the cup
  5. Wait 3 minutes
  6. Remove the tea bag
  7. Add milk if desired

2. Pseudocode

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

3. Flowcharts

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.


Decomposition and Abstraction

Two key techniques are used when designing algorithms:

Decomposition

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:

  • Designing the user interface
  • Handling user input
  • Implementing game logic
  • Managing scoring

Abstraction

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 in Everyday Life

Algorithms are not just for computers. Many everyday tasks follow algorithmic thinking:

  • Navigating to school — turn left, walk 200m, turn right, etc.
  • A recipe — a set of ordered steps with inputs (ingredients) and an output (a dish)
  • Long division — a step-by-step mathematical procedure

Understanding algorithms helps you think logically and systematically, which is a core skill for GCSE Computer Science.


Key Vocabulary

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)

Summary

  • An algorithm is a finite, step-by-step set of instructions for solving a problem.
  • Algorithms can be represented in natural language, pseudocode, or flowcharts.
  • Good algorithms are finite, definite, effective, and produce an output.
  • Decomposition breaks problems into sub-problems; abstraction removes unnecessary detail.
  • Understanding algorithms is essential before writing any program.