Community resourceWorksheet

OCR H446 1.4.2 Linked lists: add and remove

Part 6 of 14 · H446 1.4.2 · Data structures

Changing a linked list means rewiring pointers in a safe order, and the wrong order silently orphans the rest of the data. This H446 1.4.2 worksheet takes students from insertion at the head and after a node through to removal of head, middle and final nodes, checking reachability after every change.

Students will:

  • insert a node at the head and after a given node in an order that preserves the remainder
  • remove head, middle and final nodes without leaving data unreachable
  • state what actually changes on insertion, and what does not need to move
  • implement head removal and insertion after a node using nodes held as objects
  • compare an array-of-nodes implementation with an object-node one and name a shared invariant

Inside: 8 explanation cells, 2 multiple-choice questions, 1 fill-in-the-blanks cell, 2 written answers and 2 Python tasks. 23 marks, about 45 to 55 minutes.

Series: H446 1.4.2 · Data structures, part 6 of 14.

Shared by Coding PathwayVerified teacher

  • 15 cells
  • About 45 minutes
  • CC BY-SA 4.0
  • Shared 31 Aug 2026
  • Updated 3 Sept 2026

Preview

The whole resource, exactly as a class sees it. Answers and marking are held back.

Linked lists: add and remove

Insertion and removal change links, not a block of neighbouring values. Update order protects reachability.

By the end, you will be able to

  • insert at head and after a node;
  • remove head, middle and final nodes;
  • order pointer updates without orphaning data;
  • implement operations procedurally or with objects.

Reactivate: traversal starts at head and follows next until null.

Safe insertion order

Safe linked-list insertion orderAnew BC1. B.next = C2. A.next = BConnect the new node onward before redirecting the previous node; otherwise C may be orphaned.

To insert B between A and C, first save/connect B.next to C, then redirect A.next to B. Reversing the first update without saving C can make the remaining list unreachable.

Worked removal

List A → B → C. To remove B: keep previous=A and current=B; set previous.next = current.next, so A now points to C. For head removal, set head = head.next. For final removal, previous.next becomes null.

After every operation, check: head reaches every logical node exactly once and traversal ends at null.

Multiple choice1 mark

When inserting newNode after current, which update should preserve the old remainder first?

  • AnewNode.next = current.next
  • Bcurrent.next = newNode
  • Chead = null
  • Ddelete current.next
Multiple choice1 mark

What normally changes when a node is inserted into an array-of-nodes linked list?

  • AEvery later value shifts one array position
  • BLink fields and possibly the head pointer, not every later stored value
  • CThe physical array must be sorted
  • DAll next fields become null

Guided pointer table

Draw before/after next fields for insert X at head, insert Y after the second node, remove head and remove the final node. Circle the link that preserves the remaining list.

Written answer6 marks

For A → C → D, insert B after A and then remove C. State each pointer update in a safe order and give the final list.

Use names such as B.next and A.next.

Students type their answer here.

Supported implementation: object nodes

Implement remove_head(head). A Node has data and next attributes. Return (removed_value, new_head); return (None, None) for empty.

Coding task3 marks
def remove_head(head):
    pass

Independent transfer: insert after a node

Implement insert_after(current, new_node). Both are Node objects with a next attribute. Preserve the old successor, link new_node to it, then link current to new_node. Return new_node.

Coding task4 marks
def insert_after(current, new_node):
    pass
Written answer4 marks

Compare an array-of-nodes implementation with an object-node implementation. State one representation difference and one invariant shared by both.

Focus on indexes/references and logical links.

Students type their answer here.

Closed-book checkpoint

Complete each sentence from memory. There is no answer bank and correctness is held for teacher review.

Fill in the blanks4 marks
For safe middle insertion, point the new node to the old completion 1 before redirecting the previous node. Otherwise the remainder may become completion 2. Removing the head changes the completion 3 pointer; removing a middle node makes its predecessor bypass it to its completion 4.

Review your responses

Check every response against its command word and the supplied constraints. Strengthen unsupported answers with accurate method, mechanism, state or contextual consequence before submitting.