Data Structures
First observe the behavior in Explore mode, then switch to Apply to test each operation with intent.
A stack is a linear data structure that follows the Last-In-First-Out (LIFO) principle. Elements are added (pushed) and removed (popped) from the same end called the top.
LIFO (Last-In-First-Out): Last element added is first to be removed
Browser History: Back button uses stack
Only the top can be removed next. Click blocks to inspect stack positions.
TOP
Ready|Waiting for a stack operation
Time: Depends on operation|Space: O(1) auxiliary
Pseudocode
Stacks are LIFO: the top is always the next value to leave.
Explore mode: inspect the top element to understand LIFO behavior.
Push: Add element to top → O(1)
LIFO (Last-In-First-Out): Last element added is first to be removed
In Apply mode, test one operation and explain its complexity before running the next.
Before clicking run, predict the next index/pointer movement and then verify it.