Skip to content

Algorithms

KS3 Computing revision notes, key terms and practice questions.

In short

An algorithm is a set of step-by-step instructions to solve a problem. Decomposition means breaking a problem into smaller parts. Abstraction means removing unnecessary detail to focus on what matters. Pattern recognition means spotting similarities.

For KS3 students in Years 7, 8 and 9 (KS3 Computing).

Computational thinking

  • An algorithm is a set of step-by-step instructions to solve a problem.
  • Decomposition means breaking a problem into smaller parts. Abstraction means removing unnecessary detail to focus on what matters. Pattern recognition means spotting similarities.

Building blocks

  • Sequence: steps run in order. Selection: a decision chooses which steps run (IF… THEN… ELSE). Iteration: steps are repeated (loops such as FOR and WHILE).
  • Algorithms can be written as flowcharts or pseudocode (structured English that looks like simple code).
  • Flowchart symbols: an oval for start and end, a rectangle for a process, a diamond for a decision, and a parallelogram for input or output.

Searching

  • A linear search checks each item in turn from the start. It works on any list, but is slow for long lists.
  • A binary search only works on a sorted list. It checks the middle item, then throws away the half that can't contain the target, and repeats. It is much faster for long lists.

Sorting

  • A bubble sort compares each pair of neighbouring items and swaps them if they are in the wrong order. It repeats passes until no swaps are needed. After the first pass, the largest item is at the end.
  • A merge sort splits the list into single items, then merges them back together in order. It is faster for long lists.

Key terms

Algorithm
A set of step-by-step instructions to solve a problem.
Decomposition
Breaking a problem into smaller parts.
Abstraction
Removing unnecessary detail to focus on what matters.
Sequence
Steps carried out in order.
Selection
Choosing which steps to run, using a decision.
Iteration
Repeating steps, using a loop.
Flowchart
A diagram that shows an algorithm using symbols.
Pseudocode
An algorithm written in structured English, like simple code.
Linear search
Checking each item in a list in turn.
Binary search
Searching a sorted list by repeatedly checking the middle item.
Bubble sort
Sorting by comparing and swapping neighbouring items.
Merge sort
Sorting by splitting a list up and merging it back in order.

Quick questions on Algorithms

What is an algorithm?
A set of step-by-step instructions to solve a problem: A recipe is an everyday example.
What is decomposition?
Breaking a problem into smaller parts: Smaller problems are easier to solve.
What is abstraction?
Removing unnecessary detail to focus on what matters: A map of the London Underground is an example.
Which flowchart symbol shows a decision?
A diamond: It has two exits, such as yes and no.
What are the three basic building blocks of algorithms?
Sequence, selection and iteration: Every program is built from these.
What is iteration?
Repeating steps, using a loop: FOR and WHILE loops are examples.
What does a binary search need?
The list must be sorted: It relies on knowing which half the target is in.
How does a linear search work?
It checks each item in turn from the start: It works on unsorted lists too.

Algorithms: questions and answers

For a sorted list of 1000 items, which search is usually faster?
Binary search. It halves the list each time.
How does a bubble sort work?
It compares pairs of neighbouring items and swaps them if they are in the wrong order. It keeps making passes until no swaps are needed.
How does a merge sort work?
It splits the list into single items, then merges them back together in order. It is faster than a bubble sort for long lists.

Practise Algorithms: 13 questions

Download these notes as a PDF

Next topic: Programming (blocks and Python)

More in Computer science

LycoLearn is still loading…

This can take a little longer on a busy school or home network. If nothing happens, try refreshing the page.

LycoLearn didn’t load properly

Part of it didn’t arrive. Try refreshing the page in a minute, or open LycoLearn in another browser.