Data Structure: Stack

Stack is a data structure that follows LIFO policy. LIFO: Last in First Out

Usually, inserting an element to stack is called pushing, and deleting an element is called popping. That’s why we see in most programming languages they have PUSH and POP methods/functions.

When we call PUSH function, a new element is inserted to the stack. When POP is called, the element at the top of the stack which is the freshest element of the stack is popped out.

Some use cases for Stack are: - Browser back button - Undo/Redo operations in a computer program.