Stack (LIFO)last in first
out.
Linear collection of data
elements.
Insertion and deletion
take place only at one
end(TOP).
Insertion operation is
There are two operations
implement on stack:-
1. Push(insert)
2. Pop(delete)
 Deletion operation is called
pop operation in stack.
 Stack is restricted kind of
data structure.
 Ex:-
To add a new element in
stack . This operation is
called push in stack . If we
want to push element in
stack first of all we have to
check condition “overflow”.
Overflow means if TOP of
stack is equal to MAXSTACK
and we want to add new
element into a stack then a
condition “overflow” is occur.
ex:- Here
top=5
Maxstk =5
So” overflow condition
occur”
10
20
30
40
50
1
2
3
4
5
To remove existing element
from stack . This operation is
called pop in stack . If we want
to pop element in stack first of
all we have to check condition
“underflow”.
Underflow means if top=0
or top=null and we want to
delete element from stack
then the condition
“underflow” is occur. Ex:-
Here
Top=0
Maxstk =5
So condition “underflow”
Occur.
1
2
3
4
5
Thanks

Operation on stack

  • 2.
    Stack (LIFO)last infirst out. Linear collection of data elements. Insertion and deletion take place only at one end(TOP). Insertion operation is
  • 3.
    There are twooperations implement on stack:- 1. Push(insert) 2. Pop(delete)
  • 4.
     Deletion operationis called pop operation in stack.  Stack is restricted kind of data structure.  Ex:-
  • 5.
    To add anew element in stack . This operation is called push in stack . If we want to push element in stack first of all we have to check condition “overflow”.
  • 6.
    Overflow means ifTOP of stack is equal to MAXSTACK and we want to add new element into a stack then a condition “overflow” is occur. ex:- Here top=5 Maxstk =5 So” overflow condition occur” 10 20 30 40 50 1 2 3 4 5
  • 7.
    To remove existingelement from stack . This operation is called pop in stack . If we want to pop element in stack first of all we have to check condition “underflow”.
  • 8.
    Underflow means iftop=0 or top=null and we want to delete element from stack then the condition “underflow” is occur. Ex:- Here Top=0 Maxstk =5 So condition “underflow” Occur. 1 2 3 4 5
  • 9.