Adding to and removing from a linked list – OCR A Level Computer Science lesson (H446)
Students learn to add an item in order to, and remove an item from, an array-based linked list, updating the start pointer, the free list and the end of the list.
Lesson 7 of 15 in unit 12.8 Data Structures, taught in Year 12, Spring 2. It answers one big question: What must change when a stop is added or removed?
By the end, students can add an item in order to, and remove an item from, an array-based linked list, updating the start pointer, the free list and the end of the list.
- The Build (the main task)
- Complete the table, start pointer and free pointer after Tillbrook adds an urgent stop in postcode order and then removes a cancelled stop from a driver's route (6 marks).
- Support version
- Before-and-after diagrams with arrows; students list the pointer changes as numbered steps before filling the table.
- Challenge
- Write the remove algorithm in OCR pseudocode, including the case where the stop removed is the first one.
- Real-world link
- A customer cancels a delivery and an urgent parcel joins the same route.
- Key words
- Null pointer, Free list and Remove, each with a definition, an icon and a common mix-up on the key vocabulary slide.
- Misconceptions it tackles
- “Removing an item wipes its data from the array”; “0 can mark the end of the list”.
- 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.
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)
- 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.