Linked List — Reasoning Check

Apply the module invariants, traces, and boundary conditions.


Get every question correct to pass this checkpoint. You can review feedback, revise your answers, and submit again.

1. While reversing 1→2→3, a program assigns cur.Next=prev and then advances cur=cur.Next. Why can it lose the remaining nodes?

Select one answer.

2. Reverse groups of k=2 in 1→2→3→4→5. What is the value of the fourth node in the result? Enter one integer.
3. Two distinct nodes both contain value 7 and both point Random to the first node. What must a deep copy preserve?

Select one answer.

4. An LRU cache of capacity 2 performs Put(4,40), Put(5,50), Put(4,44), Put(6,60). Which key is evicted? Enter one integer.
5. In a three-node list A→B→C→nil, remove the third node from the end using a dummy predecessor. Which edge must be changed?

Select one answer.

6. What value is stored in the last node when adding reverse-order digit lists [9,9,9] and [1]? Enter one integer.
Join Discord