What is stack?
--> Stack is the collection of objects accessed from one end. eg. pile of the plate in the kitchen. It has two primitive operations are: Push for addition and Pop for deletion. All the operation are on the top of the stack.
--> LIFO: last in first out
PUSH Operation & Implementation:-
--> always added on top of the stack. syntax:- push(n)
eg.
-define the size of the stack.
- define the top of stack -1.
-push(n): it will push the element into the stack.
Overflow
-If there is no more space to push element in the stack, the stack is full!!!
POP Operation and Implementation:
-remove an element from the top of the stack. eg n = pop().
Underflow:
-if the stack has no more element and tried to remove the element. the stack is empty!!!
--> Stack is the collection of objects accessed from one end. eg. pile of the plate in the kitchen. It has two primitive operations are: Push for addition and Pop for deletion. All the operation are on the top of the stack.
--> LIFO: last in first out
PUSH Operation & Implementation:-
--> always added on top of the stack. syntax:- push(n)
eg.
-define the size of the stack.
- define the top of stack -1.
-push(n): it will push the element into the stack.
Overflow
-If there is no more space to push element in the stack, the stack is full!!!
POP Operation and Implementation:
-remove an element from the top of the stack. eg n = pop().
Underflow:
-if the stack has no more element and tried to remove the element. the stack is empty!!!