stacks and queue
stacks and queue
stacks and queue
Expt.
No. 01.... Page No..2.....
while Ct)
paiotf(lnStack Menu--n
pint!("4. Pushin ");
pxiot! 2.Pop.ln)2
pxint! (u3.Displau to")2
prinr "
4.Exrt.An );
pont{(" Eotex your choíce:")
S can!"od" & choice :");
Switch (choice )
push C) barak;
case 2: if (empty ())
pain (
Stack Underlow"):
popc), baak;
-AchievER
Date.
iot num;
poiotfC Enttx on inttqtr to be pushed: ");
S Canfuf.d&oum)
toptt,
stack Ctop] num;
lse
pint{lnStack Full.\o ")2
display0;
Noid pop)
1f (P top z=0)
is iY.d, stack Ctop)i
pxint f("Item popped
top-
-AchievER
Date..tes
Page NNo.
No,
Expt.
else
printí ("n tack Empy.\n")2
display);
io+ fulO
if(top MAX)
else
|iot empty)
1fCtop=-)
void displa )
iot head-top
if Cheadz=0)
-AchievER
Date..semm
No,
Page No. .
Expt.
while C head1 )
piotf\nd" stackCh tad 1)2
bead--2
else
-AchievER
Output
-111Stack Menu
4. Push
2-Pop
3- top
Disploy
4.Exit
Enttr our choice : 1
Enttr an inteqe to be pu shed:16
The ittms io he stack at. C14)
16 Push
top
--Stack Menu stack
4- Push
3.Display Push(24)
4.Extt top
Cia)
Push
Stack Menu-
1-Push top
9. Pop 4
4
3. Diaploy
Ex i4
Stack
Enter yourchoice :1
Enttr an intger tobe pushed: 17
17
24
----Stack Menu
4.Push push
a- Pop
3 Disploy R4
4-Ex?4
Enttr your choice: 1.
-Stack Menu
1.Push Display
.Pop
3.Disploy
top
4 Exi4
€nter your choíce :3
The ?tms in the gtack are; Stact
24
33- Pop(4)
Display
4.Exit
Entey your choice: Stack
Hmpopped 240 i
-Stack Menu
4. Push
Q- Pop
Pop(1a)
3.Displa y
4.€x?
Entr uour chotce
Item popptd.16
Stack (s enpty.
Stack Men u
4.Push
2.Pop
3.Disploy
4.Exi+
eottr uour choice :
Sack Undertow Stack Underflow
Stack Menu
A. Push
Q.Pop
3.Drsplay
4.Exi
Case
Ctd,&chaice)
Switchcchoic
1 printf
)
Entt yOur choice i "
bxcak
display(9, f):
brcak;
-AchievER
Date...
Case 4 exi(o)
deiauldiiot f(^ ToNalid Laput ry Ag ain\o);
-AchieveR
Date.
Page No.
Expt. No.
-AchieveR
GvdOutput
Quue Opevation
4. Push
Aontrar
Q. Pop
3.Display
4.Ext 4 ushcss)
Enttr
En tr
your cho ice
em to be
h
1insd5S Quiu
4€xi4
Cnttr your choice 1
tnttr the itt m to be inse fed:3G
a.Pop 55 X
3. Drsplay
4exit
Enttr your choice 1
Enter the itemn to be Oveftow
insted; |2 Queu
ueue Overftow
Queue pevation
1. Push
a. Pop
|3. Display
4.Ext 55
Entr ourchoice
u
Queut Contots
:3 front
TLOY
|56| Dtsplay
|a9|
|36|
Quue Opration
1-Push 2
aPop 36
3-Disp lay
4-€xi4 Pop(55)
Popl6s) ent reov
Enrter your choia :)
Pop Succusful,element deletedi gss
Gueue Opration
4.Push
&.Pop
3.Drsplay
4. ExP4
Pop (ta)
Enttr uour choice ,a
Pop Successful,eleenent deleted aq
Queue Operation
4. Push Queu
a.Pop
3.
Display
4- Exit topt8s)Empty
enttr your chotce a deleted 36
Pop Suceess ful ,element
Gueue Operaion
1.Push
Q.Pop
3-Display
4-Exi4
Pop X,Qud empty
Cottr your chotce &
Stack Underftouw
Queue Undefow.
G ueue Opevation
1.Push
a.Pop
3.Dísplay
4. Exit
En ter your choie: 4