Ch 5 · Linked Lists — Nodes on a Chain · Data Structures & Algorithms
Topic 5 of 10 in Data Structures & Algorithms — Foundations — 2 lessons.
Nodes and Pointers
A linked list does not store items side by side. Instead each node holds a value and a pointer to the next node. The list is just a reference to the first node (the head). Inserting at the front is O(1) — no shuffling — which is its superpower over arrays.
Reversing a Linked List
Reversing a linked list means flipping every next pointer to face backwards. We walk the chain with three references — prev, curr, and the saved next — in a single O(n) pass.
All topics in Data Structures & Algorithms Beginner
- Thinking Like a Computer Scientist
- Arrays & Lists — The Workhorse
- Stacks — Last In, First Out
- Queues — First In, First Out
- Linked Lists — Nodes on a Chain
- Searching — Finding the Needle
- Sorting — Putting Things in Order
- Recursion — Functions That Call Themselves
- Hash Tables — Instant Lookups
- Mini-Projects & Practice