What do you mean by stack program?
Get me an example stack program?
Answer Posted / harshita gangwar
<STACK>
stack is a linear kind of data structure .it works on "LIFO"
,LIFO stands for last in first out. in stack we perform two
operations i.e. insertion & deletion & these operations
performs only at one end i.e called "TOP".
for eg: a stack of books..etc
there are two operations performs-
(1) push (2) pop
there are also two conditions occures in case of stack i.e.
i.e. (i)underflow (ii)overflow
/*ALGO FOR PUSH OPERATION*/
PUSH( stack[],TOP,item, len)
1) set TOP=-1
2) if TOP==len-1, then
print stack is overflow.
3) else
set TOP=TOP+1
set stack[TOP]=item
4) EXIT.
In the PUSH operation the overflow condition generates.
/*ALGO FOR POP OPERATION*/
POP(stack[],TOP,item,len)
1) set TOP=len-1
2) if TOP==-1, then
print stack is underflow.
3) else
set item=stack[TOP]
set TOP=TOP-1
4) EXIT.
In the POP operation the underflow condition generates.
OTHER EGS OF STACK:-
(I)a stack of disks.
(II)a common model of a stack is plates in a party
where fresh plates are "PUSHED"(inserting) on to the TOP &
"POPED"(deleting) from the TOP.
Is This Answer Correct ? | 11 Yes | 0 No |
Post New Answer View All Answers
What is the benefit of oop?
State what is encapsulation and friend function?
What is purpose of inheritance?
What is a class in oop?
hi all..i want to know oops concepts clearly can any1 explain??
What is encapsulation oop?
Where You Can Use Interface in your Project
What are two types of polymorphism?
Can destructor be overloaded?
What is difference between abstraction and encapsulation?
Why is encapsulation used?
What does enum stand for?
What is the fundamental idea of oop?
Templates mean
What does sksksk mean in text slang?