introduction of Stack
Introduction of Stack
- A data structure that implements this concept is called a stack.
- A stack is a collection of data items that can be accessed at only one end, called top.
- Items can be inserted and deleted in a stack only at the top.
- The last item inserted in a stack is the first one to be deleted.
- Therefore, a stack is called a Last-In-First-Out (LIFO) data structure.
There are two basic operations that are performed on stacks:
- PUSH
- POP
PUSH: It is the process of inserting a new element on the top of a stack.
POP: It is the process of deleting an element from the top of a stack.