AlgoScope

Array

Numbered slots side by side, so reaching any one of them costs the same.

Data structures, data structure, beginner
The value at index 3 is 2. Access cost O(1).5011422384i
The value at index 3 is 2. Access cost O(1).5011422384i

Array: Access index 3

Result, step 3 of 3

a[3] = 2. Constant time, whatever the size.

How array works

Cost

Access
O(1)
Search
O(n)
Insert
O(n)
Delete
O(n)
Space
O(n)

Insert and delete at the end are O(1) when capacity allows.

Leads to

Topics that need this one first.

Taught by the same lesson

Array covers these too, in the same run.