1 of 4

Your RightSignal

Data structures · 2 of 111 / 3

Arrays

The concept

Why item one million is as quick to reach as item one

An array is a row of same-sized items stored side by side in one unbroken block of memory, each numbered by an index starting at 0. Nothing sits between items, so the computer calculates where one is instead of searching.

Picture a list of 1,000,000 temperature readings, each a 4-byte number. Reading index 999,999 takes the same single step as reading index 0, so access is O(1), constant time no matter how long the array is.