A stack is a linear data structure in which all the insertion and deletion of data are done at one end only. Stacks can be implemented by using other data structures like, array and linked lists.
The Stack is widely used in many applications of internal compute processing. One of the widely but least known applications is of having it being used in converting and evaluating Polish notation expressions.
- Infix
- Prefix
- Postfix
Comparative to arrays and linked lists, which allows us to insert and delete values from any place. The stack is a linear data structure, and all the insertion and deletion of its values are done at the same end which is called the top of the stack.You can imagine the stack of plates and pile of books to understand the stack better. As the item in this form of data structure can be removed or added from the top only, it establishes the property that the last item to be added will be the first item to be removed.so you can say that the stack follows the Last In First Out (LIFO) structure.