OCR J277 2.1.3: Searching and sorting algorithms
The free BugBot lessons that teach this point, a robot to try it on, and the past-paper questions that test it.
What it covers
Searching is one of the jobs computers do most: finding a name in a contact list, a word in a document, a marker in a robot's camera log. The simplest search algorithm looks at every item in turn until it finds the one it wants. That is linear search, and this lesson has the robot use it to find a marker in a ring around it.
- The algorithm
- Counting the work
- Searching what the robot sees
- When linear search is the right choice
Or do it in the simulator, with tasks that mark themselves
Lessons that teach it
- F5.5 Linear search Algorithms
Checking every item: finding a marker in the robot's sightings. - F5.6 Binary search Algorithms
Halving a sorted list, and why it needs sorted data. - F5.7 Bubble sort Algorithms
Passes and swaps, stopping early, and hearing a tune become a scale. - F5.8 Insertion sort Algorithms
Building a sorted part one item at a time, on the robot's readings. - F5.9 Merge sort and comparing algorithms Algorithms
Splitting and merging, and choosing between the searches and sorts.
Try it on a robot
The task from F5.5 Linear search, running here. Change the program and press Run.
Past paper questions on this
Real exam questions that test this, each worked through with a program you can run.
- AQA 8525 June 2025 Paper 1, Question 6: Show a bubble sort and a merge, compare them, and justify a binary search 10 marks
- AQA 8525 June 2023 Paper 1, Question 12.1: Trace a binary search 4 marks
- AQA 8525 June 2023 Paper 1, Question 12.2: Write your own linear search 7 marks
- AQA 8525 June 2022 Paper 1, Question 4: Which of two programs is more efficient, and why 3 marks
- AQA 8525 June 2022 Paper 1, Question 12: Trace a bubble sort on three items 8 marks
- AQA 8525 Sample Paper 1, Question 7: A bubble sort with a swapsMade flag: data type, identifiers, and a trace table 10 marks
- OCR J277 June 2025 Paper 2, Question 3(a): Show the steps of a merge sort on eight numbers 4 marks
- OCR J277 June 2024 Paper 2, Question 3(c): Show a binary search for 10, its pre-requisite, and name merge sort 5 marks
- OCR J277 June 2024 Paper 2, Question 9(a)(ii): Complete a linear search function 4 marks
- OCR J277 June 2023 Paper 2, Question 3: Insertion sort: temp, the inner loop, and bubble sort compared 8 marks
- OCR J277 June 2022 Paper 2, Question 3(a): Show each step of a merge sort on eight numbers 3 marks
- OCR J277 June 2022 Paper 2, Question 3(b), (c): Describe a binary search, and a linear search for a number that is not there 6 marks
The specification is OCR's own document; this page says which of our lessons teach point 2.1.3 and is not endorsed by the board.