Stack
- It is a Last In First Out (LIFO) data structure
- Piles is another name used for stack since data element are placed one above the other and last element on the pile is the first one to be removed (LIFO)
- Push-down list: A list in which the next item to be removed is the item most recently stored (LIFO); Stack is a LIFO data structure
- The stack is used in situations where data have to be stored and then retrieved in reverse order.
- Real-life implementation of the stack is shown:
The ball which is stored last (D) will be the first one to be taken out of the container
Important Points
- Stacks data structures are also called FILO (first in last out)
- push(), pop(), peek() are some of the functions of stack data structure



