Array

Collection of items stored in a contiguous set of memory.

How an array works?

a = int[3]
a[0]

What’s happening underneath the hood?

Limitations

Note: Arrays in high-level languages like JavaScript and Ruby don’t have these limitations. There’s a lot going on under the hood.

Operations

OperationBig O
Accessing an element at indexO(1)
Inserting an element at indexO(n)
Deleting an element at indexO(n)
Updating an element at indexO(1)
Traversing an arrayO(n)

Algorithms