All exams← All GCSE Computer Science (AQA) notes

Algorithms & computational thinking: GCSE Computer Science (AQA) revision notes

Revision notes

What is an algorithm?

An algorithm is a precise, step-by-step set of instructions for solving a problem or completing a task. It must be unambiguous, finite (it stops eventually) and produce a correct result for all valid inputs. Algorithms can be shown as pseudocode, flowcharts or written descriptions.

Computational thinking skills

AQA expects four core skills.

  • Abstraction: removing unnecessary detail and keeping only what matters to the problem.
  • Decomposition: breaking a large problem into smaller, manageable sub-problems.
  • Algorithmic thinking: designing the logical steps needed to reach a solution.
  • Pattern recognition: spotting similarities between problems so existing solutions can be reused.

Searching algorithms

  • Linear search: checks each item in turn from the start. Works on unsorted or sorted lists. Worst case checks every item, so it is O(n).
  • Binary search: repeatedly halves a sorted list, comparing the middle item to the target. Much faster than linear search on large lists, O(log n), but the data MUST be sorted first.

Sorting algorithms

  • Bubble sort: repeatedly swaps adjacent items that are in the wrong order, passing through the list until no swaps are needed. Simple but slow, O(n squared).
  • Merge sort: splits the list in half repeatedly until single items remain, then merges them back together in order. Faster than bubble sort on large data, O(n log n).
  • Insertion sort: builds a sorted section one item at a time, inserting each new item into its correct place.

Expressing algorithms

You need to be able to read, trace and write algorithms in AQA pseudocode and flowcharts, using sequence, selection (if/else) and iteration (for, while, do until). Trace tables are used to track variable values line by line as an algorithm runs, and are the standard way to check your understanding and find errors (bugs).

Common mistakes

  • Confusing linear and binary search conditions, or trying binary search on unsorted data.
  • Miscounting comparisons/swaps in bubble sort trace tables.
  • Forgetting that arrays in AQA pseudocode are usually zero-indexed.
  • Mixing up efficiency (Big O) with simply 'which one is faster to write'.
  • Not decomposing a problem before attempting to code or design it, leading to messy logic.

Key facts

Flashcards

What are the four computational thinking skills in AQA GCSE Computer Science?
Abstraction, decomposition, algorithmic thinking and pattern recognition.
tap to reveal
What is decomposition?
Breaking a large, complex problem down into smaller, more manageable sub-problems.
tap to reveal
What is abstraction?
Removing unnecessary detail from a problem and keeping only what is relevant to solving it.
tap to reveal
How does linear search work?
It checks every item in the list one by one, from the start, until it finds the target or reaches the end.
tap to reveal
How does binary search work, and what condition must be met first?
It repeatedly halves a sorted list, comparing the middle item to the target; the data must already be sorted.
tap to reveal
What is the time complexity of linear search?
O(n) - worst case, it checks every item.
tap to reveal
What is the time complexity of binary search?
O(log n) - much faster than linear search on large sorted lists.
tap to reveal
How does bubble sort work?
It repeatedly swaps adjacent items that are in the wrong order, passing through the list until no swaps are needed.
tap to reveal
What is the worst-case time complexity of bubble sort?
O(n squared).
tap to reveal
How does merge sort work?
It splits the list in half repeatedly down to single items, then merges the pieces back together in sorted order.
tap to reveal
What is the time complexity of merge sort?
O(n log n), faster than bubble sort on large data sets.
tap to reveal
What is a trace table used for?
To track the value of each variable line by line as an algorithm executes, helping check logic or find bugs.
tap to reveal
What indexing does AQA pseudocode normally use for arrays?
Zero-indexing, so the first element is at position 0.
tap to reveal
Name the three programming constructs used to express algorithms.
Sequence, selection (if/else) and iteration (for, while, do until).
tap to reveal
Why can bubble sort be a poor choice for very large lists?
Because its worst-case complexity is O(n squared), it becomes much slower than O(n log n) algorithms like merge sort as the list grows.
tap to reveal
Practice questions

Algorithms & computational thinking: 5 practice questions

Q1. A programmer breaks a large problem down into smaller, more manageable sub-problems before writing any code. What is this technique called?
  • A.  Decomposition
  • B.  Abstraction
  • C.  Pseudocode
  • D.  Backtracking
Show answer & explanation
✓ Answer: A. Decomposition
Decomposition means splitting a complex problem into smaller parts that are easier to solve and code individually. Abstraction is different: it means removing unnecessary detail to focus on what matters, not splitting the problem into parts.
Q2. What is meant by 'abstraction' in computational thinking?
  • A.  Repeating a set of instructions until a condition is met
  • B.  Removing unnecessary detail so only the important features of a problem remain
  • C.  Splitting a problem into smaller sub-problems
  • D.  Testing a program with a range of data
Show answer & explanation
✓ Answer: B. Removing unnecessary detail so only the important features of a problem remain
Abstraction involves filtering out detail that is not relevant to solving the problem, leaving a simplified model to work with, such as a map ignoring building heights. It is often confused with decomposition, which is about dividing a problem rather than simplifying it.
Q3. A linear search is used to find the value 8 in the list [3, 6, 8, 1, 9]. How many comparisons does it make before finding 8?
  • A.  1
  • B.  3
  • C.  2
  • D.  4
Show answer & explanation
✓ Answer: B. 3
A linear search checks each item in order starting from the first: 3, then 6, then 8, which is a match on the third comparison. It does not skip elements or use the fact that the list might be sorted.
Q4. Which condition must be true for a binary search to work correctly on a list?
  • A.  The list must not contain duplicates
  • B.  The list must contain only numbers
  • C.  The list must be sorted
  • D.  The list must have an even number of items
Show answer & explanation
✓ Answer: C. The list must be sorted
Binary search relies on repeatedly comparing the target to the middle item and discarding half the list, which only gives correct results if the list is already sorted. It works fine with text data, duplicates, or an odd number of items as long as it is ordered.
Q5. A binary search is performed on the sorted list [2, 5, 9, 12, 17, 23, 30, 41] to find the value 23. What is the first item the algorithm compares 23 to?
  • A.  12
  • B.  2
  • C.  41
  • D.  17
Show answer & explanation
✓ Answer: A. 12
Binary search starts at the middle of the list; with 8 items, the middle index (position 4, using 1-indexing rounded down) holds the value 12. Since 23 is greater than 12, the search then continues in the upper half of the list.
Test yourself
See the GCSE Computer Science (AQA) page

More GCSE Computer Science (AQA) topics