Algorithms: searching, sorting and efficiency – AQA GCSE Computer Science lesson (8525)
Pupils learn to trace, explain and compare linear and binary search and bubble and merge sort, and explain efficiency.
Lesson 1 of 7 in unit 11.4 Revision, taught in Year 11, Spring 2. It answers one big question: How do I trace, compare and explain algorithms?
By the end, pupils can trace, explain and compare linear and binary search and bubble and merge sort, and explain efficiency.
- What happens
- Bell Task: four quick questions on searches and sorts. Reteach 1: a binary search traced in AQA pseudo-code (mid rounds down; the list must be sorted). Reteach 2: explaining merge sort as numbered steps. Build: exam-style questions on Riverbank Libraries' catalogue and the café's leaderboard, marked against a mark scheme. Challenge: Riverbank's audiobook IDs are 203, 215, 224, 230, 241, 258, 266, held in a sorted array indexed 0 to 6. The binary search from part (a) is run with target ← 260. State the value of mid each time round the loop, in order, and the output (4 marks); The café has two lists to sort into ascending order. List A is the six regulars' scores, 3, 5, 8, 12, 15, 14, which are almost in order. List B is 4,000 scores from a weekend tournament, in no order. Compare a bubble sort and a merge sort for these two lists, stating which you would use for each and why (4 marks); Write an AQA pseudo-code subroutine binarySearch that takes a sorted array ids and a target as parameters and returns the index of target in ids, or −1 if target is not in ids (6 marks).
- Main task
- The algorithm below, in AQA pseudo-code, carries out a binary search of ids for 120. Complete the trace table. You may not need every row (4 marks). State how many items of ids the binary search in part (a) compared with 120, and how many items a linear search would compare to show that 120 is not in ids (2 marks). Book 130 is added to the end of ids, so ids has 10 items. The binary search for 130 outputs False. Explain why the search does not find book 130 (2 marks). A new café worker explains merge sort like this: '1. Split the list in half. 2. Sort each half. 3. Put the halves together.' Rewrite the explanation as numbered steps that would earn 4 marks (4 marks).
Also sold in the Revision unit bundle, which includes the medium term plan, and in the full-year and complete-course bundles.
An independent resource written for AQA GCSE Computer Science (8525). It is not endorsed by AQA.
What's included
- Slide deck (PowerPoint)
- Lesson plan (Word)
- Worksheet (Word)
- Support worksheet with scaffolds (Word)
- Single-teacher licence: use and adapt it with your own classes
More for GCSE Computer Science (AQA)
See allPupils learn to write code on paper for long code questions, earning design and program marks, and use subroutines, validation and records.
Pupils learn to convert between number bases, add binary numbers, apply shifts and calculate image, sound and Huffman sizes without a calculator.
Pupils learn to explain the CPU's components and the Fetch-Execute cycle, memory and storage, software, languages and translators, and Boolean logic.
Written for the specifications named. Not endorsed by or affiliated with any exam board.