A stack is a simple data structure that adds and removes elements in a particular order.
Every time an element is added, it goes on the “top” of the stack. Only an element at the top of the stack can be removed, just like a stack of plates. This behavior is called LIFO (Last In, First Out).
![](https://tejsumerucom3d8f0.zapwp.com/q:intelligent/retina:false/webp:true/w:150/url:https://tejsumeru.com/wp-content/uploads/2020/06/IMG_20200612_163331.jpg)
Terminology
Adding a new element onto the stack is called push.
Removing an element from the stack is called pop.
Applications
Stacks can be used to create undo-redo functionalities, parsing expressions (infix to postfix/prefix conversion), and much more.
A stack can be implemented using an array or a linked list.