0% found this document useful (0 votes)
21 views24 pages

Dsa - 2

Uploaded by

shubham sharma
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)
21 views24 pages

Dsa - 2

Uploaded by

shubham sharma
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/ 24

Date.

UNLT-3 Page No.


Expt. No.

QisWaide a pog) Om de c2oote a linary toee.

staset thode oLhede int ava)ef


stact tnode nede = (stect thode ) mallc
sizeof Catuct itnade);
hbde yah = valuei
odel= NOLL;
2

ad pointat (stauet tnode ttee)

pzinteut (toee> )

vod main)
neLsModo (so)
Teacher's Signature:
WRITO-LINE
8.Ouput

30, 10 50, 20
Date.

Expt. No. Page No.

9t 2nemocde (20

paint'out (r96t);
paintf (n');

Qnd display he nodes in ingda, paeada


past ode
A ctaunt nsde

stat DEde tneLnode t valuec


Stoat hode btaode =(stauat hsde ) maleo
sizaef Catut nade )
(tnade
tnode ’02 NOLL

ttser)

Teacher's Signature:
WRITO-LINE
15.Qutput
50

)0>70 ’40> 20>9060-> SO30

Poe Orde.:
50’ 207010-40 - 2o> 60> 30

10->4070>60’ 20* 2O’ 30-50


Page No.
Expt. No.

paint %d to ee Vale

Uad paeSlder Cstatct nde ttoee)


toee ’yauo
6fpaintf(^od
Paedo (toee

treo s)
od

ved main c)

nenode (3o);

Teacher's Signature:
Date.

Expt. No.. Page No.

De0tll nenade (io);

prinif ("la Post de)

sench treoGnth nade inueskèen andpresdo pseenhhen


A#indude &odiozh>
4indudo &stdlidh
staaot

Lstoust BsT node *nes node Geoe Cint value)


malle cizeeh (atauct BST nado ),;
demp> Rey,
e n dempj Teacher's Signature:
WR[TO-LINE
20. Qutput

BST
27, 38,43, 50 Se
Signature: Teacher's WRITO-LINE
ADLL) ot nade RST Staot
Cl man int
xogt) STnode Cstauat d in
Jeid
nsdej aetom
ue;
(nadeigkt, lode ineet
key) nade (waln> if ebe
ualua seate nsde hear
aue itnole,
nt Ansde (staet Nade inget BSTnsde stouet
No. Page No. Expt.
Date.
Date.

Page No.
Expt. No..

la2.zide a
Ond inet am eleman
As#indado stdioh
#include ctdlikh>
stost Node
ind key i ctak Node *k ctuet Node siahti

ind height Cotant Alode *nC

t hax int a int )

staet Nade *neNade int key


stat Nsde *de stuct Naade * malse
Caize f (staut Noda );
eht

Teacher's Signature:
WRITO-LINE
Expt. No.. Page No..

gtauct ode
ctact Nade *r ht

NOde *a 'aight,

x2 heght nax(heght (r>laft, heght ( ight))+ l;


max Cheight (ya loft), heght ly oight)) l

int got Balan ce_ (Node *n)

aehin heiakt (N> lo<4)- heght (N ght);


3

Teacher's Signature:
WRITO-LINE
WRITO-LINE
Signature: Teacher's
(nade>
loft Retat lejz lelt node
(node
); Retat telt schan
(hada) Rotade. sight achwn
(nade)Baknce got alane int
aight); Cnode> hoight
lelt (nde (heigkt max t heiaht
= nade>
nde 2ekem
ehe
insetLnde
ziqht >kay) nade>aahi= Ckey>nade if che
nede
fnade
)e Reg 'node,iNULL) CNade tinsot= Nade
No. Page No. Expt.
Date.

Expt. No. Page No.

hade>jaht =siaht Rotak (nadegkt)

int main ()
staust Nade t s NOL
xeot. inext Csost, 20),
ingot Gatot

Poinkf ("fse odor toabeua che cengtuated Aw "

xeam

Teacher's Signature:
-WRITO-LINE
Date.

Expt. No. Page No..

b2.aide aa potgm do c2eote a Heah

An #incude tdio h>


usid cah int *a int t()
int demp
ved heahuhe (int o[l, ind Nind ii
int logost 2*i+2

lagt

nt sdatbx = (N/2)-L

int nain )

Teacher's Signature:
WRITO-LINE
92.Qdpt

l6

fooy Repsceyion
17, 16, 18, h,1S, 2, S, 8, 1o,s
Page No.
Expt. No.

Paintf ("%d

Q23 Waie a pragpam of Meah ot?

Ans#inclade <stdio h
yeld swah Cint ta int t )
int demp
**(Faa Jemp

ueid hehib lint a [ , intn inti £


int laget i
int lept 2tiL

lagest
(laaest
aight,
)
Caga
Teacher's Signature:
WRITO-LINE
Date.

Page No.
Expt. No..

veid deah Sot int aor l int n)


(int aia h e L =Oi--)

int main )
int o [ : f 2s, 12, s, 45, 33, 24, lo, 432

pint ("Soled alag

Teacher's Signature:
WRITO-LINE
Unit -4 Date.

Expt. No.. Page No.

matix

P#includetdio h>

xeLd caah Al;Matax (int AcdLN4l int a[]e])


fs Cint i
Cind 20Ntlt)

le (intio, ik tt)
int x E_aa[o]:

AdLxJyI=1

Je int i=l;iNit) +)

Teacher's Signature:
WRITO-LINE
Date.

Expt. No. Page No.

int main

Q2sJoite a proanam in c/+t to taaele a Go


uing. DÆ S AMGidhm:
Asinc ludo {stdio h
# include slath

int i

WRITO-LINE
Teacher's Signature:
Date.

Expt. No. Page No.

int visided v
Vaid

DES Ca,

int adiatix IvI[] =fo3y


int

PointAdi latix (adi otax );


DES (alatax 2)
Teacher's Signature:
WRITO-LINE
Date.

Expt. No.. Page No..

ting

VEid add d¡e Cint ga7h [AX VERTICE STLMAX_ VEfIGa


int ntt nd ond)c

int wehu, int sat lelex )


int visidednAX ERT ICESI: foBi
Jnt aueue PIAX VERII CESl
vsided Lodat Vellexl=
Paistf ("ßES Tsaeal ades")
Jnd oslont Veex

("bd Cusront Veslex )


ko Lint izo ivelhice;itt)e

Teacher's Signature:
WRITO-LINE
Signature:. Teacher's WRITO-LINE
Wetex) aat vetce Kgahh, Bfs
"dslat
Velkex SCant
aleial cbo
B£S
leex; sdat int
lend) Rsat
ead) ctat, hd
erdi stat, int
itt)
(h%d"ladgsi scank
IL
VER IAX- VERIICES akhLAX Scanh int
oticse heeme ho
main int
No. Expt.
No. Page
Date.

Page No._
Expt. No.

in Clct indement
Paimts
As #inclucde tdigh>
# dohine INE

S0,3s, 3, 12,
KS, 35,0,S), 25,

int nain)
int nê edge
int sola ed vIj
selorked Co 1 = taua
Deght
int min = LNE

Teacher's Signature:
- WRITO-LINE
Date.

Expt. No. Page No.

iCcoleated Si)

min = GLJL;

sdected.Cyl: tauej

Teacher's Signature:
WRITO-LINE

You might also like