Single lesson · Written for OCR A Level (H446)

Adding to and searching a binary search tree – OCR A Level Computer Science lesson (H446)

Students learn to add a value to a binary search tree as a new leaf and write a search that follows one branch from the root.

Also in a bundle Data Structures – OCR A Level Computer Science lessons (H446) 15 lessons for £45 · save 25% on buying separately

Lesson 9 of 15 in unit 12.8 Data Structures, taught in Year 12, Spring 2. It answers one big question: How does a binary search tree halve the work at each step?

By the end, students can add a value to a binary search tree as a new leaf and write a search that follows one branch from the root.

The Build (the main task)
Write a function that searches Tillbrook's binary search tree of tracking numbers, stored as left, data and right arrays with −1 as null, and returns True if a number is present (6 marks).
Support version
An iterative search given as a Parsons problem in OCR pseudocode and Python side by side, with a tree diagram to trace it on.
Challenge
Write the insert procedure that adds a new tracking number as a leaf node, then describe how a node with two children is removed.
Real-world link
A customer phones to ask whether their tracking number is on today's list.
Key words
Leaf node, Child node and Order, each with a definition, an icon and a common mix-up on the key vocabulary slide.
Misconceptions it tackles
“A new value can be inserted between two existing nodes”; “Searching a binary search tree checks every node”.
OCR H446 specification
1.4.2 (c); 2.3.1 (e) (algorithms for the main data structures: stacks, queues, trees and linked lists, with depth-first (post-order) and breadth-first traversal of trees).

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.

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

An independent resource written for OCR A Level Computer Science (H446). It is not endorsed by OCR or Cambridge University Press & Assessment. Programming project (NEA) lessons teach general skills on a made-up example project and give supervised time, within JCQ's rules on the help a centre may give.

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 A Level Computer Science

See all

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