Core · Module 4 · Lesson 7 of 9
Dynamic Arrays and Linked Node Structures
Contrast contiguous geometric growth with non-contiguous node traversal, evaluate pointer chasing against cache locality, and build dynamic data containers.
By the end you can
- Build growable dynamic arrays using geometric capacity doubling with realloc
- Implement singly and doubly linked lists with dynamic heap allocation
- Analyze amortized O(1) vector insertion versus O(1) linked node splice costs
- Evaluate the CPU cache locality penalty of pointer chasing across linked nodes
Builds on Arena and Pool Memory Allocators.
01 · A question first
Why does iterating through an array of one million integers take less than a millisecond, while iterating through a linked list containing the exact same numbers takes dozens of times longer? The difference reveals how contiguous memory and CPU cache architectures penalize pointer chasing.
Make a guess before you read on.
02 · The idea
Members only
Unlock the full lesson
This lesson is part of the membership. Join to read it in full, along with every other premium deep dive.
What's inside
- Start with the problem
- How the idea works
- Why it is correct
- What it costs
- Pitfalls and variations
- Where it is used
03 · Practice
Asked in interviews
Something wrong with this lesson? Report a problem