Linked Lists
Linked lists trade random access for efficient insertions. Learn pointers, reversals, and cycle detection.
Lessons
1. Intro
Why linked lists matter
2. Node Structure
The building block
3. Traversal Pattern
Walking the list
4. Dummy Head Technique
Simplify edge cases
5. Insertion Operations
Adding nodes
6. Deletion Operations
Removing nodes
7. Problem - Reverse Linked List
The classic pointer problem
8. Iterative Reversal
Three-pointer technique
9. Recursive Reversal
Let the stack do the work
10. Reverse Linked List Solution
Implement your solution
11. Fast-Slow Pointer Technique
Two pointers, different speeds
12. Finding the Middle
Fast-slow technique
13. Problem - Linked List Cycle
Detect if a cycle exists
14. Cycle Detection with Fast-Slow
The tortoise and hare
15. Linked List Cycle Solution
Implement your solution
16. Finding Cycle Start
Where does the cycle begin?
17. Problem - Merge Two Sorted Lists
Combine two sorted lists
18. Merge with Dummy Head
Compare and append
19. Merge Two Sorted Lists Solution
Implement your solution
20. Doubly Linked Lists
Pointers in both directions
21. DLL Insertion
Update both directions
22. Problem - LRU Cache
Hash map + doubly linked list
23. LRU Cache Design
Combining structures
24. LRU Helper Methods
Building blocks for LRU
25. LRU Cache Solution
Implement your solution
26. Reverse Sublist
Reverse part of a list
27. Reverse in Groups
K-group reversal
28. Problem - Reorder List
Combine multiple techniques
29. Reorder List Approach
Three-step solution
30. Reorder List Solution
Implement your solution
31. Problem - Copy List with Random
Deep copy with random pointers
32. Hash Map Approach
Map original to copy
33. Interleaving Approach
O(1) space solution
34. Copy List Solution
Implement your solution
35. Quiz: Linked Lists
Test your understanding
36. Section Recap
What you learned
Practice Problems
Fundamental doubly linked list problem teaching how to merge multiple lists into one. Great for understanding prev/next pointer manipulation.
Interactive problem requiring binary search on a linked list. Teaches efficient searching techniques with limited queries.
Simulates deque operations with front/back manipulation. Teaches pattern recognition in cyclic linked structures.
Uses array-based linked list technique for O(1) deletions. Essential pattern for maintaining traversal order with efficient removal.
Constructive problem that benefits from linked list thinking for sequence building. Teaches creative list manipulation.
Range coverage problem where linked list approach simplifies interval merging and traversal.
Binary search with collision detection. Sequential processing similar to linked list traversal patterns.
DP optimization with divide and conquer. Understanding linked structure helps in optimizing transitions.
Graph-based string problem where character chains form linked structures. Teaches topological thinking.
Segment tree with matrix multiplication. Understanding sequential dependencies like linked nodes.
Interval manipulation problem where linked list approach simplifies cut operations and tracking.
Greedy selection with linked structure for maintaining sorted order while removing elements.
The fundamental linked list reversal problem. Master both iterative and recursive approaches.
Classic Floyd's cycle detection algorithm. Essential two-pointer technique for O(1) space cycle detection.
Find the cycle start node. Teaches the mathematical proof behind Floyd's algorithm.
Foundation for merge sort on linked lists. Teaches dummy node technique for cleaner code.
Extends merging to k lists using min-heap. Classic divide and conquer or priority queue application.
Two-pointer technique with n-gap. Teaches one-pass solution for positional problems.
Combines finding middle, reversing, and merging. Tests multiple linked list skills in one problem.
Doubly linked list + hash map for O(1) operations. Classic system design data structure.