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 a superclass in oop?
What is an example of genetic polymorphism?
What is data binding in oops?
Is enum a class?
What is byval and byref? What are differences between them?
Will I be able to get a picture in D drive to the c++ program? If so, help me out?
Where You Can Use Interface in your Project
What does sksksk mean in text slang?
Why it is called runtime polymorphism?
How to hide the base class functionality in Inheritance?
Advantage and disadvantage of routing in telecom sector
write a program using c++ to implement single contiguous memory mangement techniques.display the content of the main memory after yhe allocation of jobs and percentage of the wastage of the main memory
What is overloading and its types?
What are the 4 main oop principles?
Why is polymorphism important in oop?