Exam skills: tracing and writing data structure algorithms – OCR A Level Computer Science lesson (H446)
Students learn to complete trace tables for data structure algorithms line by line and correct faulty code by line number.
Lesson 14 of 15 in unit 12.8 Data Structures, taught in Year 12, Spring 2. It answers one big question: How do you score full marks on a data structure question?
By the end, students can complete trace tables for data structure algorithms line by line and correct faulty code by line number.
- The Build (the main task)
- Complete the trace table for the given push and pop calls on a Tillbrook van stack, then identify the two errors in the given linked list insertion algorithm, giving each line number and its corrected line (8 marks).
- Support version
- The trace table with the top pointer column filled for the first three rows, and the error hunt narrowed to five lines.
- Challenge
- Discuss whether Tillbrook should store a driver's route as a linked list or an array, given that stops are added and cancelled all day (9 marks, levels 7–9 / 4–6 / 1–3).
- Real-world link
- The van stack and route list from lessons 3 and 7, set as exam questions.
- Key words
- Stack, Linked list and Complete, each with a definition, an icon and a common mix-up on the key vocabulary slide.
- Misconceptions it tackles
- “A trace table can be filled in from what the algorithm is meant to do”; “Correcting code means describing the problem in words”.
- OCR H446 specification
- 1.4.2 (data structures: (a) arrays of up to three dimensions, records, lists and tuples; (b) linked lists, directed and undirected graphs, stacks, queues, trees, binary search trees and hash tables; (c) creating, traversing, adding data to and removing data from each, with arrays and procedures or with objects); 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.
Students can do it all on paper.
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)
- Exam skills - tracing and writing data structure algorithms - Quiz Quiz Trade Cards
- Single-teacher licence: use and adapt it with your own classes
More for A Level Computer Science
See allStudents learn to choose a record, tuple, list or array of up to three dimensions for given data, and declare each.
Free sample lessonStudents learn to compare static and dynamic data structures and justify one for a given use.
Students learn to trace push, pop and peek on an array-based stack and write a pop that checks for an empty stack and moves the top pointer before returning.
Written for the specifications named. Not endorsed by or affiliated with any exam board.