The A* algorithm – OCR A Level Computer Science lesson (H446)
Students learn to describe how A* uses f = g + h to choose nodes, and explain what its heuristic estimates and why it reduces the nodes searched.
Lesson 4 of 17 in unit 13.4 Path-finding, Computational Methods and Project Development, taught in Year 13, Autumn 2. It answers one big question: How can an estimate make the search smarter?
By the end, students can describe how A* uses f = g + h to choose nodes, and explain what its heuristic estimates and why it reduces the nodes searched.
- The Build (the main task)
- Explain how the A* algorithm would use the straight-line estimates to P: G 10, A 9, B 10, C 5, D 2, E 4, P 0 to find a Harrowgate Fulfilment robot's route from G to P, and why it expands fewer nodes than Dijkstra's algorithm.
- Support version
- A table of nodes with g, h and f columns and the h values given, plus the sentence frame 'A* chooses the open node with the lowest f, where f = …'.
- Challenge
- Explain what A* does if every h value is set to 0, and what that shows about the link between A* and Dijkstra's algorithm.
- Real-world link
- Harrowgate Fulfilment's robots know their position on the floor, so the planner can estimate the straight-line distance left to Packing.
- Key words
- A* algorithm, Heuristic and Estimate, each with a definition, an icon and a common mix-up on the key vocabulary slide.
- Misconceptions it tackles
- “A* carries on like Dijkstra's algorithm until every node has been visited”; “A heuristic is just 'a shortcut' or 'a rule of thumb'”.
- OCR H446 specification
- 2.3.1 (f) (standard algorithms: here Dijkstra's shortest path algorithm and the A* algorithm, traced on weighted graphs and compared (the searching and sorting algorithms in this point were taught in 12.4)).
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 allStudents learn to describe how Dijkstra's algorithm finds the shortest path in a weighted graph and why each step keeps the lowest total.
Free sample lessonStudents learn to trace Dijkstra's algorithm with a priority queue, recording each distance and previous node, and read the path back from the goal.
Students learn to plan sprint 2 from their design and review of sprint 1, and write modular, annotated code with dated journal entries.
Written for the specifications named. Not endorsed by or affiliated with any exam board.