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.
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