Conceptly
← All Concepts
🧱

Array

FoundationsContiguous indexed sequence

An array is the basic collection for keeping values in order and reading them directly through integer indexes. It is the first structure you reach for when the question is fundamentally about position: what is at slot 0, slot 5, or slot n.

β–ΆArchitecture Diagram

πŸ” Structure

Dashed line animations indicate the flow direction of data or requests

Why do you need it?

When data is stored as a plain sequence with no positional addressing, repeatedly finding the nth item means stepping through earlier items again and again. In loops, image processing, numerical work, and table-based algorithms, that repeated traversal becomes the bottleneck. Arrays solve the problem of direct positional access.

Why did this approach emerge?

Early programming and systems work depended on predictable memory addressing. Numerical computing, buffers, and text processing all benefited from a model where many same-shaped values could be stored in one predictable block and reached through offset arithmetic. That is why arrays became a universal primitive across languages and runtimes rather than a niche library abstraction.

How does it work inside?

An array reserves one contiguous block of memory. To read a[i], the runtime takes the base address of the block and adds an offset derived from the index and the element size. That makes reads and overwrites fast because the location is computed directly rather than traversed. The trade-off is that inserting or deleting in the middle requires shifting later elements to close or open space.

Boundaries & Distinctions

Arrays and linked lists are both sequential collections, but the strengths come from opposite storage assumptions. Arrays are strong when random access and dense scanning matter. Linked lists are strong when relinking nodes matters more than jumping to position n. Arrays also differ from hash tables: arrays are addressed by integer position, while hash tables are addressed by computed keys.

When should you use it?

Arrays show up in render lists, numeric vectors, image buffers, dynamic-programming tables, and any workload where order and positional access matter together. They also underpin structures that look more sophisticated on the surface, such as binary heaps. The more your workload is dominated by repeated reads and ordered scans rather than structural edits, the more natural arrays become.

Table processingUI list renderingDynamic programming tablesHeap storage