Mission 4: "Relinking the Relay" 🔗
Assess the damage. Traverse the linked list from the provided 'head' to the tail and report the value of each data packet you find by calling `reportValue(value)`.
00:00
Mission Objective
Given a `head` node, write a `while` loop that traverses the list. Inside the loop, call the provided `reportValue()` function with the current node's value, then move to the next node.
Step 1 / 2
1. The Story: The Mission Briefing
"A vital data conduit is shattered. The data packets (nodes) are floating in space, but each contains a pointer to the next one in the sequence. You must repair the chain to restore communication."
2. The Problem
How do you insert and delete items from the middle of a sequence efficiently?
3. The Task
You will first write code to traverse the linked list to assess the damage. Then, you will insert a new "repeater" node into the middle of the chain by simply updating the pointers of its neighbors, a task that would have been costly with an array.
4. Concepts Applied
Traversing, Inserting, and Deleting nodes in a Linked List.