What’s a Linked List, Anyway? [Part 2]
Vaidehi Joshi
1562

I couldn’t understand what could go wrong when doing insertion of a new node in a bad order.

1: Add new node.

2: Add reference in new node to first node in the list.

3: Change head reference from first node to new node.

Changing 2 with 3 would give me:

1: Add new node.

2: Change head reference from first node to new node.

3: Add reference in new node to first node in the list.

I’m unable to see the problem because the pointer to the next node in first node would still point either to null or the next node in the list.

Is there something I’m not seeing?

Anyway, nice article!