OCR J277 · Component 02 · §2.1 · Paper 2

§2.1 Algorithms

How do we break problems down into steps, represent them formally, and search or sort data efficiently?

Computational thinking is the systematic way of approaching problems so that a computer can solve them. Decomposition breaks a large problem into smaller, more manageable sub-problems. Abstraction strips away irrelevant detail, leaving only what matters for the solution. Algorithmic thinking constructs a clear, step-by-step solution. These three principles appear at every level of computing — from writing a simple function to designing a database system.

Search and sort algorithms are the canonical examples. Binary search is dramatically faster than linear search for large sorted datasets — it halves the search space each step, giving O(log n) behaviour versus O(n) for linear search. Bubble sort is simple but slow (O(n²)); merge sort divides and conquers for O(n log n); insertion sort works well for nearly-sorted data. OCR is the only GCSE board to require all three sort algorithms, and expects students to apply and trace them, not memorise code.

A sorted list contains [3, 7, 12, 19, 25, 31, 44, 58]. Use binary search to find the value 25, showing each step. How many comparisons are needed? Compare this with linear search for the same value.

Key algorithm facts

Linear search: check each item in order; works on unsorted lists; up to n comparisons
Binary search: halve the search space each step; requires sorted list; up to log₂(n) comparisons
Bubble sort: repeatedly swap adjacent items if out of order; simple but O(n²)
Merge sort: split in half, sort each half, merge; O(n log n); requires more memory
Insertion sort: build sorted list one item at a time; efficient for nearly-sorted data

What students must understand

Diagrams

A sorted list of numbers one to nine with low, mid and high pointers marked for binary search
Binary search. The low, mid and high pointers halve the search space with each comparison. The list must already be sorted.
Merge sort trace: a list of eight numbers repeatedly split into halves, then merged back together in sorted order
Merge sort. Split the list until each part holds one item, then merge the parts back together in order.

Diagrams: PG Online (Paul Long), OCR J277 textbook. Used under the school site licence.

Linking questions

Practice

Video Support

Craig'n'Dave — OCR J277
2.1 Algorithms — unit playlist