CS concepts
Array vs Linked List Explained: 5 Tests to Pick the Right One
Updated Nov 28, 2026 · 3 min read
Default to an array (in Python, a list). It reads any index in O(1), appends in O(1) on average, and its items sit side by side in memory, which the CPU cache loves. Use a linked list when you add or remove at the front or middle a lot, or when the problem hands you one, like an LRU cache.

Key points
- ●Access by index: array O(1), linked list O(n). Array wins.
- ●Add to the front: array O(n), linked list O(1). Linked list wins.
- ●Insert or delete in the middle when you already hold the spot: linked list O(1).
- ●Arrays are faster in practice because of the CPU cache.
- ●Default to an array; pick a linked list for front-heavy inserts or LRU cache.

The question
Interviewers love this one: array or linked list? Both store a sequence of items. The difference is how they sit in memory, and that changes what's cheap and what's expensive.
- An array keeps its items side by side in one block. In Python, a
listis a dynamic array. - A linked list keeps each item in its own node, and each node holds a pointer to the next one. The nodes can live anywhere in memory.
Neither one wins everywhere. Here are the five tests from the visual sheet above, one by one, with the Big O for each side and a winner.
Test 1: read the 5th item
An array jumps straight to it: O(1). It knows where the block starts and how big each slot is, so it can work out the address.
A linked list has to walk: start at the head, follow next, follow next, until you reach the 5th node. That's O(n).
Array wins.
Test 2: add to the front
An array has to shift every item over by one to make room at the start. O(n).
A linked list makes a new node and points it at the old head. O(1). Nothing else moves, however long the list is.
Linked list wins.
Test 3: insert or delete in the middle, already holding the spot
This test has a catch in the wording: you already hold the spot. An array still has to shift everything after it, O(n). A linked list just rewires two arrows, O(1).
If you don't already hold the spot, the linked list has to walk there first, which is O(n) again.
Linked list wins.
Test 4: real speed and memory
Big O isn't the whole story. Array items sit side by side in memory, which the CPU cache loves: reading one item brings its neighbors along for free.
Linked list nodes live somewhere random in memory, and every node stores an extra pointer on top of its value. More memory, and more waiting on the CPU.
Array wins.
Test 5: add to the end
A Python list appends in O(1) on average. Now and then it runs out of room and copies everything into a bigger block, but that's rare enough that it averages out.
A linked list with a tail pointer also appends in O(1).
Tie.
The scorecard
| Test | Array | Linked list | Winner |
|---|---|---|---|
| Access by index | O(1) | O(n) | Array |
| Add to the front | O(n) | O(1) | Linked list |
| Middle, holding the spot | O(n) | O(1) | Linked list |
| Memory and real speed | Side by side, cache friendly | Extra pointer, scattered | Array |
| Add to the end | O(1) on average | O(1) with a tail | Tie |
Which one to pick
Default to an array, a plain Python list. It's the right call most of the time, and it's faster in practice even when the Big O looks the same.
Reach for a linked list when you add or remove at the front or middle a lot, or when the problem hands you one. LRU cache is the classic example.
In an interview, say why. "I'll use a list because I need fast index access" or "I'll use a linked list because I insert at the front on every step" tells the interviewer you know the tradeoff, not just the answer. If you can't name a reason for the linked list, you probably want the array.
Frequently asked questions
When should I use a linked list instead of an array?
When you insert or delete at the front or in the middle a lot and you already hold the spot, because a linked list only rewires pointers. Also when the problem gives you one, like LRU cache. For everything else, use an array.
Why is a linked list O(n) to access by index?
The nodes aren't next to each other in memory, so there's no way to jump to the 5th one. You start at the head and follow next pointers one node at a time.
Is a Python list an array or a linked list?
A Python list is a dynamic array. Reading by index is O(1), and append is O(1) on average, because it occasionally copies everything into a bigger block. Inserting at the front is O(n), since every item shifts over.
Why are arrays faster than linked lists in practice?
Array items sit side by side in memory, which the CPU cache loves. Each linked list node lives somewhere random in memory and also stores an extra pointer, so walking a list makes the CPU wait more.