Linked List Traversal

Walk a linked list node by node, following next pointers until the target is found or the list is exhausted.

Walk a linked list node by node, following next pointers until the target is found or the list is exhausted.

The current pointer refers to a node that has not yet been compared to the target.

Linked lists provide no random access — the only way to reach a node is to walk from head.

Stopping early on match avoids unnecessary work without changing worst-case complexity.