Simulators

Stacks & Queues

Stack Visualisation

itemactivereturned
[0]─
[1]─
[2]─
[3]─
[4]─
[5]─
[6]─
[7]─

stack array

─
[0]
─
[1]
─
[2]
─
[3]
─
[4]
─
[5]
─
[6]
─
[7]
stackPointer = -1maxSize = 8

Last in, first out: pop always returns the item pushed most recently.

Algorithm

Run an operation from the bar above to see the algorithm.