March 24
Linked List
What a linked list means, when pointers matter more than indexes, and why this structure shows up so often in interviews.
What it is
A linked list is a structure made of nodes.
Each node stores a value and a reference to the next node.
Unlike an array, the focus here is not indexing.
The focus is who points to whom.
When to use it
It appears when the problem talks about:
- reversing pointers
- detecting cycles
- stitching sorted lists together
- inserting or removing nodes without shifting a whole array
Common mistake
The classic mistake is treating a linked list like a worse array.
That leads you in the wrong direction because these problems usually do not care about random access.
They care about pointer reasoning, link order, and structure.
Better question
Before using it, ask:
- is the problem centered on
next, head, tail, or cycle? - do I need to change links between nodes instead of moving values around?
- am I trying to solve a pointer problem as if it were an array problem?
Share this page
Copy the link manually from the field below.