DSA sheet · Linked List Patterns
Linked List DSA Notebook
My study notes from the Linked List Patterns playlist. Each page is written so that a beginner (or me, after forgetting everything) can read it once and understand which pointers move and why, which .next gets rewired at each step, the Python code line by line, and a full dry run with the list drawn as boxes and arrows.
The one idea behind every page
A linked list is a chain of nodes, each knowing only its next node. There is no index, so every trick is about where you put your pointers and which arrow you change.
Four tools solve almost everything: a dummy node (no special case for the head), fast & slow pointers (middle, cycles, gaps), reversal with prev/curr/next (always save next first), and merging with a tail pointer.
Four tools solve almost everything: a dummy node (no special case for the head), fast & slow pointers (middle, cycles, gaps), reversal with prev/curr/next (always save next first), and merging with a tail pointer.
Every page follows the same order:
① question in simple words → ② constraints → ③ intuition → ④ building the logic from examples → ⑤ approach steps → ⑥ code → ⑦ line by line → ⑧ dry run with the list drawn → ⑨ complexity & remember
Start here: basics
- 1Linked List Patterns Overviewconcept
- 2Design Linked List (Array → Linked List)iterative · recursive
- 3Search & Insert in Linked Listiterative · recursive
- 5Delete Node in Linked Listiterative · recursive
- 6Odd Even Linked Listtwo chains
Two pointers & fast / slow
- 4Intersection of Two Linked Listslength diff · switch heads
- 7Middle of the Linked Listfast & slow
- 8Linked List Cycleset → Floyd
- 9Linked List Cycle IIFloyd + proof
- 10Nth Node from Endgap of n
- 16Rotate Listk mod n
Reversal
- 11Reverse a Linked Listiterative · recursive
- 12Palindrome Linked Listmiddle + reverse
- 13Maximum Twin Summiddle + reverse
- 14Reverse Linked List IIone pass
- 15Swap Nodes in Pairsgroups of 2
- 17Reverse Nodes in k-Groupcut · reverse · stitch
- 21Reorder Listmiddle + reverse + merge
Merge, sort & dummy node
- 18Merge Two Sorted Liststail pointer
- 19Remove Duplicates from Sorted Listbrute → in place
- 20Sort Listmerge sort
- 22Remove Duplicates from Sorted List IIdummy node
- 23Partition Listtwo dummies
- 26Merge K Sorted Listsheap · divide & conquer
Linked list + stack
Numbers follow the playlist order (videos 26 and 27 share page 26, so the pages are numbered 1–26). "Next →" at the top of each page follows that order.