Claviro

Data Structures

Arrays – Indexed Data Storage

Before You Apply

First observe the behavior in Explore mode, then switch to Apply to test each operation with intent.

Core Idea

An array is a fundamental data structure that stores multiple elements of the same type in a contiguous block of memory. Each element is accessed by its index (position), starting from 0.

Observe This First

Contiguous Memory: All elements stored together in memory

Then Apply

Access: array[i] → O(1) time

Arrays – Indexed Data Storage Lab

Click an element to see how direct indexing works in O(1).

0
1
2
3
4

Selected Index

-

Selected Value

-

Ready|Waiting for an array operation

Time: Depends on operation|Space: O(1) auxiliary

Current
Comparing
Sorted / Inserted
Removed

Pseudocode

1read arr[index]
2highlight insertion position
3shift later elements right
4write new value into opened slot
5mark target element for deletion
6shift remaining elements left
7overwrite arr[index] with new value
8visit each array element from left to right

Arrays give direct index access, while inserts and deletes cost extra because elements shift.

Explore mode: click any box to inspect direct index access.

Understanding the Observation

What did you observe?

Index-based Access: O(1) time to access any element

Why did this happen?

Contiguous Memory: All elements stored together in memory

Apply with purpose

In Apply mode, test one operation and explain its complexity before running the next.

Predict next

Before clicking run, predict the next index/pointer movement and then verify it.