Module · Arrays

Contiguous Memory Visualizer

Watch how insertions and deletions physically shift elements in memory.

Memory Block · Base 1000

1000
10
[0]
1004
20
[1]
1008
30
[2]
100C
40
[3]
1010
[4]
1014
[5]
1018
[6]
101C
[7]

Size: 4/8 · Insertion/Deletion: O(n)

Array initialized with 4 elements in contiguous memory.

Operation History

  • #1Array initialized with 4 elements in contiguous memory.

Time Complexity

Access

Average
O(1)
Space
O(n)

Search

Average
O(n)
Space
O(1)

Insert

Average
O(n)
Space
O(1)

Delete

Average
O(n)
Space
O(1)

How It Works

Arrays store elements in contiguous memory blocks. Each index maps to a fixed memory address, which makes random access instant.

Inserting or deleting in the middle requires shifting every subsequent element — that is why those operations cost O(n) time.