You are on page 1of 22

.

1Dzzw CL and extlain

Root ode
Cievel ) A A,C,G are ancestor of K and J

2
eveB C D

eve E
F H

C,G,K are descendent of A

^|^
leaf node

L
Root Node Jhe
The t node
R
is te
topmost
IfRENULL then it Meuns the tee is
eMpty

2.leat ModeA node that hos na


childen is ccll ed the Jeuf
node the tezmin node.

3.Path : A
seuence of Conseru tive edges
Path
-For exun .
The cAth om
A
totO giv en
Page No.

heDeS cendant node A descendant node


514 CCes5or
CAmy
lon
modes do not heve CAmy
desendumts
the iVen
omdk caso the desrendants of node A

S.tacestor Yode :Hn amces tor of mode


Paedeessos node
the that node. to
go0t nod e does not hove any Cncestor.
the toee aivem i Fi hodes Acumd
the nodek
6In
the nMbe of edges
mode

4Dut- degoee Qut degzte


i5 the
Jeavimg thert node

B.Fosts iA fozest is
of taees s
A
set of disinit epS Corfoests)
by deleling the 0ot CAMd the
Obtuined node to n9des
edges lonnecting
level nede f
seen thet
We heue cileudy
g0t of Some Sub-aee.
Date:
Page No.

Theene, all the Sub-rees immediuteb


fegt

B (C)
G
G
H

H
(a)

oadeed Set mo
We CUm Comuert
LSImgle node the
oode Haetree
for exaHPle
SAfa CasShous. -fooest
Eic 6 Shoug Hhe CoTeSPonding tae
4. Gib)iYq
:AlL nades
nodes that
thoyt
Jevel Cand
ce Shqe.
the ct the
SaMe the
Pasent CIeccllled Giblhins Choo thes)
Ac Camd D_

Heigh t of e
fsthe to tell
Pathfoon the zro
0t nodeto he dee pst
toee with cnly
height of L,
binaas taee ofbeight hos cit
modes
2h-notes.
This becuuse eveylevelwill hov
atleustone node and
|most2 nodes
The heisht ubioasy toee
Jeuss Jega Cn+) ad
mOst
bineg
o
Coonplete binay toee4 aPlete tree

et sutisfies tuo
PaoPeties
hinay toteyerery lael
ComPlete bincay
eyet Possiby the lustfs Comeleely fles
aPPeao
ConPlete binao
teeTa, there
2

level gf T
Can heve
MOGt 6
no4es.
F

12
binary toee
They helve been Putposety
labelled em
the
node cnd left child
gat child
the QiVen node.
ete

ge N

feamula
The
hode hn left childt
be cleule
+
ed 2k CId
child um be coaleultd
childeN
mode
nade
teulculcted

nodes

cdes

2Wite Shot mote om Toumshent


Taee

We al tnow thet in C
o
nuHbe Plcyess
dectue the ànne
9lyes SaCouPIe
MSually Hhsee Plcy e
Ce

taee Cclso Colled c


selecion toee Mch
exenel
euch
oePbeSeytsthe
Match pluy ed
the Pleay eOS
it ChildaOn no eg
These tounepnentoees. abe elso CeLl1ed
wjnme toees becse
LSed to
We Co

ht the

b C

These Pluyess

euch ethe
e
2, the winnes
pluy
ad
Lwinners
e
amd lay
Wmasoeves wins declud 4euinne
n
the

Cossnsiex
given
Date:
Page No.

3
Wite down HheGtels o Comv et
Sen e) bind
with eucMPle
The following. CADe he Con vert
bmary nto ene2) toee
o
Rule : Root the bimaty
bimcty taee =
Root
of 4he toee
Rule 2: Left child of
childof the ode binady
tace mthe
Rue 3: Risht child of= node
Rizht siblna
Hhe
noden the 9enel toee.
A

B
(C) D

F) H

Com sider
k
ApAlyina the cbove Mentiened
un be Dule, the above
CoVetod
the follewig
Page 1io

Gtep 1 Mode A

toee, 50
of the biteciy
biny toee.
steP 22The Jeftoost child of he 2eot oe
will e
child left
taee alyoThese
Siblina of node thez uill
be igedchild of
tep 3: Nous
for hode Leftchild
its iht child js
cwhich
agat siblin? ene tee
Stel hi Mow
furmode C. le childof cis
its itht child
for chila of
There wille
child becuuse
ight siblna
6teP 6: Now
forodeI These
left child of 1
jn thf binuzy tee
becuuse Leff child
the has
the igt child ofI.
Step :_Mow foz node s Left child af sis
beccuse
the eneaul tace.
3The above Shos n
(I

H
Date
Page Na

ExPlain the
binay
euch Also

-
(ae 0de
Hhe follewing
lofetons Ie PefoMed
eoc h
t MOde The
1
Visitin the arot node
2. Tavesina the
he

tavessal also lled


iast ue5al In cloithmhe
lsab- tee hefoo the
Syb -tee
The he
thot he node aresseA i
Ao umy othe modes in
b-tees
Poe-0des the
MRtleasal algoaita
Agoritht n=root node,N L R

MULL
Keleet seps 2 to h hile TREE I=
SteP
Waite TREF) 9ATA
Date:
Page No.

Gep 32 CTREE
PREO RDER LEET
Ste PREORDER_CIREE RIcHTJ
CED of LooP
5: EMD

algaoith.as
etouct Poefit
Waen
taueSe the
Poe-0des alsemth M

Poefi epresslon

Angi t-ab*cd b

(B) Pos - ogde


Tauvesal
-
Post SdeD follow na
Pefoamed oeeUDSlvely
oPeatbnS
The
algeithm
at euuh
the eft Gub- ee
2. Tau Vezsin A
the iht sub-teeamdf
3. isiting
node.
Date:
Page No.

In ths aloithm, thee)-sub txce


alays auvESel hefoe he
the
Post the Post
the
-Obdes
SPecies hode
CiCcessed cfte the left +he ight
Sub-aees.
R
cll9athm
turexl cloai th t
treSuls
extauct Pos+f tut
ex>ecsOn ee

AdgoithH
Step L:Re Peot
tep 2
|Step BPas To RDER (TREE S

step JREE DATA


SEND OE

SteD

exuMPle
Ca +
62 /Cc-)

C) b) C
AnG
Cb +Cd-/
Date.
Page No.

In- ode
taveSecL nOY-eMPy binusytoee
in-oader ythe following oPotons
Peafomed ecuo5ivey
The
clth M
by
he let Sub-ee
2. visìtind +he aoot
3. TaVesina. the it
touvesdl isulso callpd
Inthe left
olwayS
he ght Suh-tee
|hothe Dout nodesvaceegs
betueen tthe edon
let cAmd

Hhe CLS
LMRaueel
AMgorih M

SteD 2 IMORDER
|Stce
CTREESEr)
3 wite TREEDATA
IMoRDER CTREE
RIoHt)
Date:
Page No.

n-0dder taueaal alsoaithn 5usMully


used to disPluy 4he eleneS of
h
lseur toee
HeeGll the elenents with
lowes tham iven ilue
befoge elenen ts higheralue
exuMPle:
(A)

Ang

Waitee shct
toees
noe expzessiom
wlth exyMPle

toees aewdela used o


stoe
calgebrcaic eAPessons.
EXpDeG5iom toees dat Gtut tue
ePoesent ma
thematice1
eyDes5ions foatat
m
Each node the ePoesents
OPescActos
teels Stoultue
Date:

Page No

For eŽIhple
Cxe CCa tCCblA))e)

e
a

(b

>esslon CoMpileS
Ma themcitical Softae and Com4eo
algeba Sy5tems

Wzitea Ghc mot


DePesetato n
InMe Mo

ankedepneserttan
Liak

toee evey node


he ddtci
wllhave
element ai Pointer to the
So
belo
Date:
Page No.

Grtauct node
Struct mode
dcter
Stauct ymde
33
binay taee hsa Pomte RooT,
thich imte to the PleMent of
he RooT =
NLLthen doee

+the Posittam is used to Poit


the left child
Hhe add
oessaf the left child ot
the mode The atdd le Posidi'om used
40 the
Finallythe Pasitia is used
Pointde thae childaf
he cddress of Ahe aght
Child Mode.ENPAy Sub-tsees
oPoesented ustn

X
6

xlox X/2X
Date:
Page No.

Mem Memo Lked DATA RrGHT

Root
2
3

2
6

(2) 3 20 3
12

12 4
13
9 12)
3-1
CBinug toee)
16

2
C1nked nefbesedhkof Bhe)
B)seuahal
|Sequeatidl oaesendeiom of
dome Simgle
Cnedlmen slone
Date:
Page No.

Though s dhe siallest techaiue fo


MeMo4 CL
isneHient
nemoy
lt of
AGeu enialules binaty follaws ghe
fallong s
A
One- dimengionel auycalled TREEy is
to 5toe the elenents 0f toee
The
azt otthe ter u)L be storedn the
tixs+locottam. That 5TREE Í1] will stoe
the da tu of he oxt element
childenofa mode stoed
The mgximum sìze af
maxinm the cocy TRES is 2ven
his the height the tsee

taeeiS epty
2

20 35

14
35 6

2) 34
12
16

16) (18) 36 12

hs
No.
Pago

Sho mote n Bnaay Taee.


C

CA
StauctUoe thot
defined CA collecianof eleents
Called nades element
taee he toPmost
cclled the t euoh
he the nast 2
child>en
A mode thayt hes 2e 0childon
CeLlle& leat hode
The elenent fs Poisated

Mens ae oee iseMP+y


Tnthe toeDOct heis
SucessoS 2
and 3MOde 2he9to Suceso 2

tus
hos tus
binary toee eeuaSive de
las every toee
fntion
node he
left Conteins
Evene Sub-toee
teminel nodes
enPts left
Teminalem Root nod e
evel o)
1

let SuesS0S
and at
Suaegss Sz.

12
Date:
Page No.

then Paren of
Ceall ed

left childand the aght ChildcfN


llevel MUHbe: Evey no de yhe h e bin0ty tee
$5aS5)nes evel Mhes
nyM6e Theamot
node defined. e
node ha
the 2iht child of heoot
tevel hode is
level higher hem its Puents
o the nuMbor
Node:
lof chi Id theit node koss. The derte
1eaf node Ss2eo, FoeigNPle
n
the te
deqaee o noàe his2, degree
degaeef

similubingry eei Two


e
be G)Mlao bath tthes
houe the Stuetuse.
hrees CAe
llCopie5 To bina
be CoPies jt hey houe
Con temt
land hey
Pondim3 node.
unodeto n
A
bine oy aeeof nede
SucesSo3
hes edes becouge
lexcep
ei fe
Pago

Consecu tive edges.


PethiA Sequen(eoe hodo
the Patth
escMle

Depth The depthof om the


Hhe Puth
Casthe lemgta
tothe
R

Root
Q.8Explain ith AoMPle tae
Tree iven
two

these
Ghould be
taersls, thes One
n0der
be
The
sed to deteDne the left elsad
31ghtehid nodes CAmd
he Poeodes/
be u
Ged t Aete ne

Congide the tesal ests

Hexe we ha[e the


GeueYe
tollow
Date:
Page No.

-StePY Use the Poe-DDded


Ldetermine the the tee The

be the
the nodo be
Side of
GteP2Eements the left
Hae 200t hode n-oDdestozveos
Seque ne he Guh- ttoee
the node Ginilady lements
the Side 0f the 300tnode
the uleal Seguence fo3
the
step 3
Recue ly select elementfaa
)
tavessul Seuence the
Geuence.
A

DBE FC B Fc

E E)E
clboue.
uill

You might also like