Doubly Linked Lists
A doubly linked list stores a next reference and a prev reference in each node. A task manager initially stores A, B, C, D, E in that order. The first node's prev and the last node's next are null; there are no extra boundary nodes.
First remove A. Then insert a new node N between C and D. Complete the table for the resulting list using node names or the word null.
| Reference | Final value |
| head | |
| tail | |
| B.prev | |
| B.next | |
| C.next | |
| N.prev | |
| N.next | |
| D.prev |
An editor stores 137 records in a doubly linked list with head and tail references. Positions are numbered from 0, and a target record initially occupies position 101.
The editor removes the first 12 records and the last 9 records. The target remains, but no reference to it is saved. You may start at either current endpoint and locate the target only by following next or prev links.
A link traversal is one move from a node to its neighbour. Starting at an endpoint costs zero traversals. What is the minimum number of link traversals needed to reach the target? Answer in traversals, as an integer to zero decimal places.