Linked List
Part of the Frontend Developer Roadmap
In short
You'll rarely use a linked list in a React app, but interviewers love them because they test whether you can move pointers around without losing anything.
A linear data structure of nodes linked via pointers rather than contiguous memory — a classic interview topic for pointer manipulation practice.

Think of it like this
A college fest treasure hunt
Each clue tells you only where the next clue is hidden. To reach clue 7, you must follow clues 1 to 6. Lose one clue and the rest are gone. That's a linked list: each node knows only its next node.
Watch it happen
Reversing 1 → 2 → 3
1/4prev is null and curr is node 1. Save next (node 2) before touching anything.
The big ideas
What you need to know
Nodes point to the next
Each node stores a value and a next pointer. The last node points to null.
No jumping to index k
Reaching the k-th node means walking from the head, so access is O(n).
Cheap insert and delete
If you already hold the node before the spot, inserting or removing is O(1). Just rewire pointers.
Slow and fast pointers
One moves 1 step, the other 2. Use it to find the middle or detect a cycle.
See it in code
Walk through the code
1// node: { val, next }2function reverseList(head) {3 let prev = null;4 let curr = head;5 6 while (curr) {7 const next = curr.next; // save before breaking the link8 curr.next = prev; // flip the arrow9 prev = curr;10 curr = next;11 }12 return prev; // the new head13}1/4prev starts as null because the old head will become the tail.
Each node is visited once, so time is O(n). Only three pointers are used, so extra space is O(1).
Save yourself the pain
Common mistakes
Oops
Changing curr.next before saving it, and losing the rest of the list.
Do this instead
Always store next first. Draw the boxes and arrows on paper before you code.
Oops
Writing lots of special cases for deleting the head node.
Do this instead
Add a dummy node before the head. Then the head is just a normal node, and you return dummy.next.
Your mission
Pointer practice
Quick check
How long does it take to read the 500th node of a singly linked list?
Go deeper
- 1Implement a singly linked list from scratch (insert, delete, traverse).
- 2Solve classic problems: reverse a linked list, detect a cycle, find the middle node.
- 3Learn the 'fast and slow pointer' (tortoise and hare) technique.
More topics at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.