When should you use an array rather than a linked list?
Almost always — and the textbook answer, which favours linked lists for insertion and deletion, is misleading on modern hardware because it ignores how memory actually behaves.
The theoretical comparison. An array stores elements contiguously: indexing is constant time, and inserting in the middle requires shifting everything after it. A linked list stores elements anywhere, each pointing to the next: inserting is constant time once you are at the position, and reaching a position requires walking from the start.
Why the theory misleads. Processors are far faster than memory, so they rely on caches and on prefetching. An array is contiguous, so reading one element pulls its neighbours into cache and the processor predicts what you will read next. A linked list scatters nodes across memory, so every step is potentially a cache miss — which can cost hundreds of cycles.
The practical consequence is that linear search through an array frequently beats a linked list even where the theory says otherwise, and that arrays win for insertion in the middle at surprisingly large sizes, because shifting contiguous memory is extremely fast while pointer-chasing to find the position is not.
When a linked list genuinely wins:
You already hold a reference to the node and need to insert or remove there, without searching — which is the case in intrusive lists inside operating system and allocator code.
Stable references, where elements must not move in memory as the structure changes.
Splicing whole sublists in constant time.
Unpredictable, very large growth where reallocating a large array is unacceptable, though most dynamic arrays amortise this well.
What to use instead, in practice: a dynamic array for almost everything; a hash map for lookup by key; a deque for efficient insertion at both ends; and a tree or skip list for ordered data with frequent modification.
The broader lesson: algorithmic complexity describes how cost grows, not what it is — and on real hardware, memory locality frequently dominates.