You are on page 1of 9

Namp Anshu kumari

Class Roll No B20 CSR- 208


Uoiversity Koll nlo 1o 900 32 0031
Popar lame Aata dtructure 4 Algori khn lab
paper(bodP Pce es sg
Exam doto 0- 01-21

Irite a progrom in to perfom the tollaing


operstins' On a draek ueng thled list.
PUSH
POP

#inelude Itdio.h
#inelude rollib»h»
Voio push U}
Voiol pop t
Joidl displaylJ;
Stvet node
Rint Vol;
8truet node next,

wct node head


oid main
t choitP =0;
Printtt"n lo choose one trom the beloo ophons Ih
printt t o Push in 2. PoP tn3. 9hoa sn 4 Ealt%
print" In fnter your choireIo;

aye 1:

push t)
reals

reale

ase 3
dsplayt
regk
3
dofaulk:
printt" please entor Yalid ohoice ";
oid pushu
int val;
Struet node phr stnueh nodosJ nalloe (sire of
Shructnode));
Cphr NUu)
Print rot able fo push he elenent;

plse
prbtf"Pnbar the Nalue ";
deont dj4 val);
head = Null

phr-yol Vol;
phr-nert NlJLL;
lead-p;
PlSe
Phr->VolVal;
pfr nert- head;
Pad phr;
prott t tor puhad";
leid popl
ot iten;
8truct ovde t ptr;
theacd =: NUILJ

priott thderflos");
else
ern .
head-> Valte;
ptr = head;
head= head-> nexF;
freel ptd;
print"atem pepped"

oid olis play )


int
Jbruetnode ptr;
ptr head
tlphre= NULlJ
protf("tark is emphy l);
else
printf" proting dtarlk elements to ");
hlhile lptr!= nlutt)
pointt(" odin", phr» dal);
ptr phr- net;

outpub
ohoose One from the beloo eptions.
pUsh
2 poP
3 Sho
4 Bxit
Ener your ohate

fntar the talup


37
Ttem pushe d
hoose one trom the be loo optlone
ush
2 POP
9 Sho
4 exit
Enter your ohoiee

Entor the value

Tte pushed
ohoose one from He boloo optrons
push
Pop

4 Cxit
Pnher your choite

iterm popp ed
2 lite a propra io to pertorn tulelk Sort
sing ray
+inelude c8taioh)
oi d quiek gort (int number fs, int firsth. lat last)

int,i, prvot, fomp;


Firste last)
Pivo first;
ifirst
last
albile (iiJ
hile ( numbrr <r Umber[pivot Jut ie
ast
tt
Alhile (numbPri] number Lplvot3)
j--;
if lii
omp = num ber tij;
pumberCi] = pumberT);
nUmber iJ temp;
3
emp:numberfprvol9;
runberpivot] rumber 3;
rumber i] femp,;
quiele Sbrt nuabe, first, i-1);
quiele dort lumb, iti, last/;

nt main
in i, bunt, number as);
Ore u qping to enter?:
PrinttHo many elemeoks
dount d Count)
printt"Enter 1.d elPmPnts", (but
Js
fer li-0; ie lbust; i++)
&tonftd 4 numor ti3);
9uieksort loumber, g (bunt-1);
printt" raler of Jorked elemenks:";
or lis0; 1 Count;itt)
Printf .d', number ));
return 0

ulput
Ho many elemenks are u qolht o enker ?: 10
Fntr 10 elemens: 23
61
13
45
19
39
So
32
12
41
prder o drted elements: 19 23 32 39 41 4S so
67 72 78

You might also like