What is Linked List?
Linked List is a linear data structure where elements are connected via pointers. Unlike arrays, it allows O(1) insertions/deletions but O(n) access.Quick Recognition: Problems involving pointer manipulation, in-place modifications, or two-pointer techniques on sequences. Keywords: “reverse”, “cycle”, “merge lists”, “middle node”.
Pattern Recognition Checklist
Use Linked List Patterns When
- Detecting cycles (Floyd’s algorithm)
- Finding middle element
- Reversing all or part of list
- Merging sorted lists
- Checking palindrome structure
- Removing duplicates
Common Techniques
- Dummy head for edge cases
- Fast/slow pointers for cycle/middle
- Prev/curr/next for reversal
- Two-pointer for nth from end
- In-place to save space
When to Use
Fast and Slow Pointers
Cycle detection, finding middle
Reversal
Reverse entire list or portions
Merging
Merge sorted lists, intersection
Dummy Node
Simplify edge case handling
Pattern Variations
1. Fast and Slow Pointers (Floyd’s)
2. Reverse Linked List
3. Merge Two Sorted Lists
4. Remove Nth Node From End
Classic Problems
| Problem | Pattern | Key Insight |
|---|---|---|
| Cycle Detection | Fast/Slow | Floyd’s algorithm |
| Middle of List | Fast/Slow | Fast moves 2x speed |
| Reverse List | Iterative | Track prev, curr, next |
| Merge K Lists | Divide/Heap | Merge pairs or use min-heap |
| Intersection | Length Diff | Align starts then traverse |
| Palindrome | Reverse Half | Reverse second half and compare |
Interview Problems by Company
- Easy
- Medium
- Hard
| Problem | Company | Key Concept |
|---|---|---|
| Reverse List | All FAANG | Basic reversal |
| Merge Two Lists | All FAANG | Two pointers |
| Delete Node | Apple, Amazon | No prev access trick |
| Middle of List | Amazon | Fast/slow |
Interview Tips
Always Use Dummy Node
Always Use Dummy Node
A dummy node simplifies edge cases when the head might change:
Reversal Template
Reversal Template
Floyd's Cycle Detection
Floyd's Cycle Detection
- Detect cycle: Fast catches slow = cycle exists
- Find start: Reset one to head, move both at same speed
Practice Problems
Reverse Linked List
Basic reversal technique
Linked List Cycle II
Find cycle start point
Merge K Sorted Lists
Divide and conquer or heap
LRU Cache
Doubly linked list + HashMap
Practice Roadmap
1
Day 1: Basic Operations
- Solve: Reverse List, Merge Two Lists
- Focus: Pointer manipulation
2
Day 2: Fast/Slow Pointers
- Solve: Middle of List, Cycle Detection, Cycle II
- Focus: Floyd’s algorithm
3
Day 3: In-Place Modifications
- Solve: Reorder List, Palindrome Linked List
- Focus: Combining techniques
4
Day 4: Advanced
- Solve: LRU Cache, Merge K Lists, Reverse K Group
- Focus: Design + complex operations