Complete the code to create a linear linked list node pointing to null.
Node nextNode = [1];In a linear linked list, the last node points to null to mark the end.
Complete the code to make the last node point back to the head, forming a circular linked list.
lastNode.next = [1];In a circular linked list, the last node points back to the head node to form a loop.
Fix the error in the condition to detect the end of a linear linked list.
while (current != [1]) { current = current.next; }
In a linear linked list, traversal ends when the current node is null.
Fill both blanks to correctly detect the end of a circular linked list traversal.
Node start = head;
Node current = head;
do {
current = current.[1];
} while (current != [2]);In circular linked lists, traversal continues until we return to the head node.
Fill all three blanks to create a dictionary comprehension that maps node values to their next node values only if the next node is not null.
var nodeMap = nodes.ToDictionary(node => node.Value, node => node.[1] != [2] ? node.[3].Value : -1);
This code maps each node's value to its next node's value if the next node exists; otherwise, it maps to -1.
