0% found this document useful (0 votes)
236 views7 pages

Stack Notes by Anand Sir

1. The document describes different data structures including stacks and their operations like push, pop, peek etc. 2. A stack is a linear data structure that follows LIFO (Last In First Out) principle where elements can be inserted and removed from one end only. 3. An example program demonstrates using a list as a stack and performing push, pop, peek and display operations on it.

Uploaded by

Robin Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
236 views7 pages

Stack Notes by Anand Sir

1. The document describes different data structures including stacks and their operations like push, pop, peek etc. 2. A stack is a linear data structure that follows LIFO (Last In First Out) principle where elements can be inserted and removed from one end only. 3. An example program demonstrates using a list as a stack and performing push, pop, peek and display operations on it.

Uploaded by

Robin Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

1.

Py1&on Dna Sncture


sfore 2 Orgause, da ta
n
Data stouctuve,ismy a

Duch a 0ay 1G0 itCccld be usedefticiujty


Dit opma pertornauce
Dta sfauctue rmay be broadly
Coteoiged uto relorig ethom:
Denia Stprutue
Cxopoud Dab Spckuo
Simp Da stauCtuna
a)Liuear Dah spdure
Array
List sfa
iuKed List
NOTES BY:ANAN STK Non Liueat Dta putue
YoUTUBE CHONNEL : CoDEITUP
b
ree
Grap
Spl Datastouctu
Array Or List are Csnaidend
Srople Dala spvCturd

Tais isn len dividod ujo t o d


ochiw:
a) Liuar D ctue SUch 6nssjs tacu
uouehiuked List
Nrn-Liuea
Tnoraph.
SJac 2
Stacu is a liacar ctala sputtone wtiu is Ced Lo
SJoreelemaut aud TF corks FT Lo (Hut 17 laMt
t o r LIfo (Lat au fiat ot).
tata SpuCtue,ar ta 6uuuat is inseted at tL
ad dele teol -fam lasb wa aud tual'i S y
tt is Daida i t works gmta Pabten O
fI Lo (fint 1u Last'oa ) meau tu elaiuou
a u i s zuseted atfsct psxitim coill se ceetd
at a t LIfo CLat JArst oe) meaus
t euueuttazt w ziusated atoill
olhtd atfint
Tu eal- t t eKpuuphs are.

a) Statu e bok NoFEs B:ANAN STR


b)stacu á4 plate t YoUTUBE CHANNEL: CoDETTOP
NoL
a) Tusertin etratim u stack is caOhPu
Deletin epezabey un stau is Caloocs lop
c)PeekBhusat is Qu last userted Valu
d isplay Slusut, mau display1 alOfta eluauts
a v a t tooardo tie

Let'a Cudershud tautio)


Suppoa e Mave 0 blauu Qist oud Je hat Dekory
s f a opEatbhon;
1 Punh 3
o35
)Puse 5o ) Pulh 75|
2 75

4) Purtu 2o 5 ) lú lo 6Fop Popprd &buut


Lo
32 3 20
3 20
275 2
75
So
o95 o Ds o 35
PeK Peek b u t Displey a00 6leia a0.
3 20 20 3 20 7
275
3
o 35

Le's do Saci porqrau NoTE By:NAN SIR


|YoUTUBE CHONNEL: CDDEITuP
4 pu (a,dataD:
Q appeud (data)
paint'6leucut Punud Outcwsuy.")
de reroeve (a):
o pop)
praint ( Fopped 11om= ",2)
duy peok (a):
on nt ("eau elouaut - ' , a -11)

do, dasplay (a):


or rauge (leuCa)-, -1,-1):
Peontla L&)
-Waiu- -
wtull TruL
Cuoie = iut( iuput ("1->Pru\2 Pop| ?-> Peak
4DrRphy |, 5- Ait | Ertee
TDu Choice"))
Choiu == 1: o furn"))
tata iut (luput ("Etu'Nauuber
Pu (a, data )
leu(a)
b =O;
ut(Stat ndertleo-D.. ")
elg:
emeve (a )
U usiu- 3:
lua)= o:
prut ('statu dutJoo... )
else
peeKa)
ei choita 4
leu (a) = = o
poivt ("Sfatu »dutou...")

diplay (a)
di Coica 5
brea

pmit (sug euoice)


NOlt3 By: HNANSIR
ToUTUPE (HONNEL: C»DE1TOp
ractxe oustim haMe3 Cud Daik{
a dictioMahy
Ctaiuiug
h Ma cWoNd
corfa pa-qtau,wite
Ke Valu paie o4, 6 studeak
peiom u
Separate User odouod uchio
PloOiug openatia):
n a u s on sfudut) ot5 tu
a) fur a Kes ( valus maKL)
dichonany, ustau a CorvopOud i ug
s9eati tdau 75
Careat g tu shme
b)opRDisplata
for Oupt: ja dictiamam
Iftauunpe Csmtest ej
ANu':90,
S'oM' 76, 'Jni':45,
Boß :89, 'ALI:G5,
R
ToM: 83} be :
ot fu jrctun (auwuld
Tu Opt
ANU BoB OM
ToM
roryau opoonkANDN
fNU 90, TOM 82
rOM 76, "JAi':45, 'B Og':89, 'ALj': 65,
ANAN STR
de puah (a, i): NOTES RY:CHANNEL:
OUTUBG CODEITUP
a-appeud(i)
deb Pop) rauge(leu(a)-1,-
1,-):
or
priut(a pop (i))
#
or np:
4 r[il>=75:
Push (9, i )
G

Pop ()
el
Print( Stacu Onckrovo)

Practice usthon
& mit hw a ist ontainiug lo ute got. You ueed
W help im Cmate a pbgrasCditG eperate
a dauedhuutiw E3 putorm u 5 u o r u
petatia bed m Qst
vesetu Csrput o5 lu Ast aud push evn
aTawmeeg \ato a sfac
4 isplay tu Csrb oth stacl.
b) Pop
f uupk:
Csoput5 tu lit i keCeua
taaupt
18, 22, 25, 3s]
N [12,13,3 4, S6, 21,71,
38, 22,98, 56, 34,12
Saue ooput:
o7rauu 1oph malebin
n- 12, 123, 34, 56, 21, 79, 98, 22, 35, 3e]
d4 puo(a.,): NoIES BY:NOND KUMAR
:ppeud (i) YoUTUBE CHANNEL: CoDELTOP
do remsve (a) :
riin aune( leu(a) -1 ,-L,-):
Pain &(apop(4))
- _ main -

Ah=-.
Push(a, i)
emeo(a)
pit(" sHack. cludoh/ot
CEaule
bo wo povgrtw) Aove beoutakpu
Dape auo c tae Daup ateten oillema
qustio e O marksks 3feck ectiom
Plem Note
f u e patkiu oh aboe tuoo gruun is Qu Da
T t yill be oKed n Board a u

aud Sir
CoDELTuP

You might also like