Linked List
Learn what a linked list really is — boxes joined by arrows — then solve the 12 linked list questions interviews ask most.
- 4 Lessons
- 12 Problems
- 51 Illustrations
Dry-run engine
Reverse a Linked List
Nodes are scattered across the heap and held together only by the addresses in their next fields.
- Input · List
- head = 10 → 20 → 30 → 40
- Output · New head
- Press play to run it
How it works
Save next = curr.next, point curr.next back at prev, then advance both: prev = curr, curr = next.
heap_nodes[4] · non-contiguous
- prevnull
- curr0x7a10 (10)
- Last pointer write—
Four nodes sit at scattered heap addresses, chained only by the address stored in each next field. Start with prev = null and curr = head (0x7a10).
What you will learn
- What a linked list is, and how nodes and next pointers sit in memory
- Why linked lists exist, and what they do better and worse than arrays
- When to reach for a linked list, and when an array is the better choice
- How to create, traverse, insert into and delete from a list in four languages
- The 12 most asked linked list interview questions, from reversal to cycle detection
- Brute force, optimal and best solutions for every problem, with a dry-run simulator
Why this course
Linked lists are where pointer thinking starts. Most mistakes in linked list problems aren't about algorithms at all — they're a lost next pointer, a missing null check, or a head that should have moved. This course is built to make those mistakes visible.
It starts with what a linked list is, why it exists, when to use one and how to use one in real code — every idea drawn as boxes and arrows, with a simulator for the basic operations.
Then you solve the 12 most asked linked list interview questions. Every problem is solved the interview way: first the brute force, then an optimal improvement, then the best solution, each with code in four languages, its time and space cost, and a simulator that shows every pointer move.
Requirements
- Comfort writing loops, conditionals and functions in at least one language
- The Arrays course, or equivalent familiarity with indexes and two pointers
- No prior pointer experience — references are introduced from scratch
Course Contents
2. Most asked interview questions
- Reverse a Linked Listcode
solutionEasy - Middle of the Linked Listcode
solutionEasy - Merge Two Sorted Listscode
solutionEasy - Remove Duplicates from Sorted Listcode
solutionEasy - Linked List Cyclecode
solutionEasy - Palindrome Linked Listcode
solutionEasy - Intersection of Two Linked Listscode
solutionEasy - Remove Nth Node From End of Listcode
solutionMedium - Swapping Nodes in a Linked Listcode
solutionMedium - Linked List Cycle IIcode
solutionMedium - Add Two Numberscode
solutionMedium - Reorder Listcode
solutionMedium
Related courses
- StackLast-in, first-out — the structure behind call stacks, undo history, and expression parsing.6 lessons · 13 problems
- QueueFirst-in, first-out — the structure behind task scheduling and breadth-first traversal.4 lessons · 5 problems
- ArraysContiguous, indexable memory — the foundation almost every other data structure builds on.12 lessons · 16 problems
