Professional Documents
Culture Documents
Stacks Using Arrays by Tanishq
Stacks Using Arrays by Tanishq
STACk
|stacks dynamie data staututes thi: Iloo the
last. a Rust ot/Ltfo Th at ten
|to a stack is R, Aust one to to be fneted
be deletel from!
stazks have ve stidons on the inseskoa and
f elemets slemetes Can be deleton
foorn one end ef
iasested os deleted onl,
the staek ie top
stack Cuample
staek size:
eshb 2
,2,! 6
Pop2
Dr. L BULLAYYA COLLEGE OF ENGINEERING
bu Ekample, ou hae a
stack of trays table.
"The tay at he top f the stact is the fust item to
be move d you tequée a fay faom that stack
Ihesfrg and dele kra elanete
tek have bestuetons
stacks oa the fertan and
deleton f elements.elemets an be fasested ox
deleted an le one end of thostak ie fim
top
Dr. L BULLAYYA COLLEGE OF ENGINEERING
AM
) Rshlstact,s,)
) Resh(staek, zu,)
224
op++;
ssay [to p]:data;
Rid(he data you
2
wou estescd:dl"data:
void popl)
(stack, vader floul )
Pte staek nder flooa
else
top.-;
Vofd displayl
iat
1£(sfackvndes flos (): - )
AMAPA Dr. L BULLAYYACOLLEGE OF ENGINEERING
-lse
eslis top;i;-)
(top: s)
3
else
2
Ft stackendey flow)
xetern 1;
Dr. L BULLAYYA COLLEGEOF ENGINEERING
else
itch
cha t:
STACk opERATLTONs. ...n):
Ratf"n push-s rn pop->2) npúplay-g)a);
do
Case 3.
displa, C);
bscak;
detautt:
3:
tgetch ();
wtee t:'y'llt:');
getek0):
Dr. L BULLAYYA COLLEGE OF ENGINEERING
Pop -> 2
daplay-z3
cholle
yeut
ttes data to peash:1
xtes
Stey dota you entesed:22
do twant to Conkne?
entes yout chohoi ce:t
Entes data to pesth::3
ter data you erteed:31
do cwant to onthue?4
enter your
entes cheice:!
data to push;e e
extes data you eteed
Pued:u4
you want to onthue?y
Dr. L BULLAYYA COLLEGE OF ENGINEERING
.
ente yo cholte:t
entey data you psh:55
entes data etered:ss
you
Do you coant to contne? y
entex your chote :2
Popped item is : 55
kont to Conhue? y
entes yous choice :3
33
2 2
do