Stacks

A stack is a last in, first out (LIFO) structure. Items are stored in the stack, but if an item is taken from the stack, it is always the last one that was added.

Stack Representation

Working with a stack

A stack uses a pop method to take the last item added off the stack and a push method to add an item to the stack.This video shows how a stack works when implemented in Python: