ITPEC FE Subject A October 2025 Question 5
ITPEC FE Subject A October 2025 — Question 5 of 60
Doubly Linked List Insertion — identify which pointers change when inserting a node.
Given a doubly linked list: A (100) → K (300) → T (200), insert G (400) between A and K.
New order: A → G → K → T
Pointers that change:
- a (A.NextPointer): 300 → 400 (now points to G)
- f (K.PreviousPointer): 100 → 400 (now points to G)
Pointers that stay the same:
- b (A.PreviousPointer): still 0 (A is still the head)
- c (T.NextPointer): still 0 (T is still the tail)
- d (T.PreviousPointer): still 300 (T still follows K)
- e (K.NextPointer): still 200 (K still points forward to T)
New node G gets fresh values (not "changes"):
- x (G.NextPointer) = 300 (K)
- y (G.PreviousPointer) = 100 (A)
Key rule: Inserting into a doubly linked list between nodes X and Y requires updating exactly 2 existing pointers: X.Next and Y.Previous. The new node's own pointers are created, not changed.
AI-generated — may contain errors
The original exam layout is preserved in the image so diagrams, formulas, tables, and code remain accurate.
This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.