Single lesson · Written for OCR J277

Linear search – OCR GCSE Computer Science lesson (J277)

Pupils learn to describe the steps of a linear search, trace it, and write it in Python with a found flag on a 1D array.

Also in a bundle Networks and Searching – OCR GCSE Computer Science lessons (J277) 11 lessons for £39 · save 11% on buying separately

Lesson 5 of 11 in unit 10.5 Networks and Searching, taught in Year 10, Summer 1. It answers one big question: How does a computer find an item in a jumbled list?

By the end, pupils can describe the steps of a linear search, trace it, and write it in Python with a found flag on a 1D array.

The Build (the main task)
Write a Python program that uses a linear search with a found flag to check whether a book ID entered by the librarian is in the unordered returns list, printing its position or 'Not found'.
Support version
Parsons problem: the program's lines are jumbled, with one distractor – an else: print('Not found') inside the loop.
Challenge
Change the program so it counts how many times the ID appears in the list (a book returned twice by mistake) instead of stopping at the first match.
Real-world link
Books come back to the returns trolley in no order – is a reserved book among them?
Key words
Linear search, Found flag and Unordered, each with a definition, an icon and a common mix-up on the key vocabulary slide.
Misconceptions it tackles
“A linear search only works on a sorted list”; “You can print 'Not found' in an else inside the loop”.
OCR J277 specification
2.1.3 (searching algorithms: how linear search and binary search work, the steps of each, and what a binary search needs (an ordered list)); 2.2.3 (additional programming techniques: using 1D arrays (Python lists) as data structures, here to hold the lists that are searched).

Every lesson follows the same Code & Commerce structure: a Bell Task recall starter, key vocabulary with definitions and icons, short teaching chunks with a check before pupils move on, The Build (one main task), challenge questions that get harder, and an exit question. Answers reveal one at a time on the slides, and everything is editable PowerPoint and Word.

Pupils need computers for the main task.

Also sold in the Networks and Searching unit bundle, which includes the medium term plan, and in the full-year and complete-course bundles.

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 (OCR)

See all

Written for the specifications named. Not endorsed by or affiliated with any exam board.