AlgoScope

Pop

AlgorithmbeginnerStack Patterns

Take the top item off. Only the top is ever touched.

Decision · step 5 of 10Stack: Push, pop, peek
53bottomtop

pop returns 9: the most recently pushed item leaves first.

Open in the player →or start at step 5

What you will see

The top item lifts off; TOP moves down.

How stack works →

Cost

BestO(1)
AverageO(1)
WorstO(1)
SpaceO(1)

How you work with it here

play it through, step one change at a time, scrub to any step, run it on your own input, predict what happens next, try operations in any order.

Screen readers: Items announce position from the top or front and value; each step announces the operation and the new top or front.

Reduced motion: Items appear or disappear in place with a crossfade instead of sliding in or out.

Before this

Taught by the same lesson

Stack covers these too, in the same run.