Single lesson · Written for OCR A Level (H446)

Backtracking – OCR A Level Computer Science lesson (H446)

Students learn to describe how backtracking uses depth-first search to abandon a failed path and return to the latest choice.

Also in a bundle Path-finding, Computational Methods and Project Development – OCR A Level Computer Science lessons (H446) 17 lessons for £45 · save 33% on buying separately

Lesson 7 of 17 in unit 13.4 Path-finding, Computational Methods and Project Development, taught in Year 13, Autumn 2. It answers one big question: What should a search do when it reaches a dead end?

By the end, students can describe how backtracking uses depth-first search to abandon a failed path and return to the latest choice.

The Build (the main task)
Describe how backtracking would find a route for a Harrowgate Fulfilment robot mapping the new mezzanine floor, where junction E leads to A and B, A leads to dead ends C and D, B leads to F and F leads to the goal G, taking branches in alphabetical order.
Support version
The mezzanine graph with a stack diagram to fill in at each step and the prompts 'push', 'dead end: pop', 'try the next option'.
Challenge
Explain how backtracking could place six orders into three delivery cages with weight limits, abandoning a partial placement as soon as a limit is broken.
Real-world link
Harrowgate Fulfilment's new mezzanine floor has not been mapped yet, so a robot explores it and records which aisles are dead ends.
Key words
Backtracking, Depth-first search and Abandon, each with a definition, an icon and a common mix-up on the key vocabulary slide.
Misconceptions it tackles
“Backtracking goes back to the very start whenever it hits a dead end”; “Depth-first search uses a queue and visits all neighbours first”.
OCR H446 specification
2.2.2 (f) (computational methods used to solve problems: backtracking, data mining, heuristics, performance modelling, pipelining and visualisation).

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.

Students can do it all on paper.

Also sold in the Path-finding, Computational Methods and Project Development 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.