Stack has two operations:-
POP: POP operation is used to remove an item from the stack. Pop operations are used to retrieve an item that is present at the top of the stack.
PUSH: PUSH operation is an insertion operation that is used to store or insert an element at the top of the stack.
When an element is removed or inserted, the same operations will be performed only at the top element of the stack. When the top element is empty which is represented by MAXTERM then this is the condition of UNDERFLOW. And when the Maxterm is having an element then also we have to add one more element then the top is shifted towards upwards and this condition is known as OVERFLOW of the stack.
POP operation decreases the stack depth or length and PUSH operation increases the stack length. FIFO stack ensures that the data is retrieved in the same order in which it is entered. A stack is a recursive data structure.
Structural definition of a Stack:
* A stack is either empty.
* Stack has the top element on which PUSH & POP operations are performed.
* Stack has similar data types object list in an ordered format.
* Stack size is not fixed. It can be variable.
* Stack doesn't consume a fixed amount of memory.