<DS/>DS_VISUALIZER
FoundationsOOPArraysLinked ListStacksQueuesTreesGraphsHashingStrings
exploreExplore
homechevron_rightTopicschevron_rightStackschevron_rightArray Implementation
data_array

STACKS · ARRAY

Array Implementation

A fixed well of slots plus a top index — fast but bounded.

Choose an operation

add_boxarrow_outward

Push

top++, then write at stack[top].

O(1)O(1)◍ 0/5
removearrow_outward

Pop

Read stack[top], then top−−.

O(1)O(1)◍ 0/5
visibilityarrow_outward

Peek

Read the top without removing it.

O(1)O(1)◍ 0/5
warningarrow_outward

Overflow & Underflow

The two boundary failures of a fixed stack.

O(1)O(1)◍ 0/5