Software → Algorithms & Data Structures
Array
A contiguous indexed collection of elements.
Motivation
An array solves the problem of storing an ordered collection of items with fast positional access.
Where it fits
It belongs to algorithms and data structures and is one of the foundations for strings, buffers, tables, and many higher-level collections.
Mental model
An array is a row of slots. The index tells you which slot to read or write.
Important details
Arrays are good for indexed access and compact storage. Insertions in the middle can be costly because elements may need to move.
Common mistakes
- Assuming arrays are always dynamically resizable.
- Forgetting that contiguous storage affects performance.