Algorithm visualizer
Pick an algorithm, enter your own numbers or use a preset, then step through the run. The pseudocode and the explanation follow each step.
Last in, first out. Push adds to the top, pop removes from the top, and peek reads the top without removing it.
Write an operation list that ends with an empty stack after several pushes. Does the stack's final state match your prediction?
Step 1 of 6
Stack (top on the right)empty
Start with an empty stack.