Skip to content

Linked List: Traversal

Task: Visit every node, starting at the head

head10203040∅VISITED102030404 nodes, 3 pointers followed

What you are watching

Walking a linked list means starting at the head and following one pointer at a time until a node's next is null. There is no shortcut: no node knows its own position, so reaching the fourth value costs four steps. That is the price the structure charges for being cheap to rearrange, and it is why reading a linked list by index is linear.