A common mistake with linked lists is doing the operations in the wrong order and losing track of the reference to a node.

Imagine we have a singly linked list with two nodes:

(head)
1 -------> 2 -----> null

How would we add a node with value 4 between the two nodes?

We can't simply make head.next = new_node. We would lose track of the address for the node with value 2.

The order is key:

1. new_node.next = head.next
2. head.next = new_node