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

Binary Tree Concepts Explained

Question and answers

Uploaded by

jyotibisht71320
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)
16 views24 pages

Binary Tree Concepts Explained

Question and answers

Uploaded by

jyotibisht71320
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

I15

JYOTI BISHT
A55T6NMENT-3

delineshefallauing ms and peoviolo


at

6)fot and Uild Nod

thod node

|luecissa a nade is aleo tu ehild rod e that


Mode

aikingansd

thu ode
he dageuo halneoe muat be O.
a

althe nodesuin thutuu


ThisOt
nadihos

)
Aom th
AauelO.

du
alNode
obt nod to hat nadl.

kooesukichds net hane ahy


Jea neds.
callud elect
chilonodes

Lenelo
al
fut
D Lenel2

ckild)
Kaal Node

apantasandgineadaples.

as tu Je
igthild.
childand
hotobmet nodeina dinay duis soat
alled
and th dottom-metaeoalld eas.
tsakenties,:
(1)A maiwwn wwboY o nesdey at a deual L o
)h ta binas th N nades, minimn

buebs,Joames Jhsat liot


)A inasyteeewith o L

6) n a nen nty nauy teeiln , is t od umto


the

(2 caohnad :
NOLL NULL

NeL NULL

) a and Ex nal Nodey


INTERNAL NODts rERNAL NODE S

nod hat Jha at nodu hat has s


leatA
A

childsun
4 has ne docendants
4
•dl Kroun ao nen dlea Kneun as tumial
denalhodes nades

extenel
Node , and S au dealhodes nd

,) aeBvysnalno dles

Heght a atuee
9 debth und

d Hogtnode
debtho.
uU Jhane d Jaa ned ul hane

dokth
uight2
Que) oliwthe elauingJoaswith exanples.

fo hilonadlotau achnode.

)CanblotubinguyTuu

{d the
exept
comflulely douatJenlnads
which

lled osight
Tue

hodas.
X

d) Skewed binanyThee

hioa too tyesa abudtuu:

skewed
ight
X skewed
nody eithenhas e e sôgkichild
ed child
erdnal
e)exended1Siany tue
nullaub
he
allhu
Buosy THeL jn wich tithApuiolnodes allod
signalu aydaphtedKDds a tallldideural
exsualodesuhsy
Uh

Qustxplainth aysayusruwdotisn a binasy


u. wau u jasard andchilben da node
inepuuAntatien
caloulatod ?
oay osaaaudatien

foyau node at ndex1


nolex= 2*i+|
ndex =
Righdchild
2*i
+2
odu utod
at index0.
kod

QtO+2

Qt2+2
141 1+2

5
2
3

index
eontsindexuoing chid'b
To caleulalu
|2
4 6

')
Qws-ib Hat dareALS binay
a C funelisn

i Cindexy sizeIlayCindex =-)


i

(2 index+),
inodyloY, m):/
viitJelt

wsd ot Ca, n);\icia


+ 2),
(2*index sgit
ahdconbasuituithhe assaysaksagstatisin

lelt chtlol
and sight
data
oighd

data
ihtchild
data

NOLL NOLL NULL NOLL


LINKD 13ST ARRAY
uaCs a linked t epasasnt Waes On asway to the
ach nao vantainsa lelt

doli
ons

agbuie hd ho
enfruoitnd. u they evaluotd.

exkaies
ingdinauy te'
fash indenal sdecuuabsndsto thecfoadu
and each ea casoaasands
nede to the abandl
Alyaritn to (entuotan exfuaoienbeu
weua a plaek uhich sthues t thenadnpoits
a
isan
eheacdeu forand
fey eachehavate
to tack walas
duahitb
rnoole
hotye
)9choeeteA
0
make Hhen
t
to
hild'andfush the
the top
ie
tree H
heinstack
nocd again. etuun
eoUnt
exampl- Abc*+
D/

slact

ftalh

9)C

a)
63)
|5)
+
) D

)/

ex

dgsuithn

Hhen

Aehontinfo
6)€lae
A selhe dot) (d.
Katusun A btoata B
tshoae
A seluel
20

90

)68-20
20
20 30 -80

(20)

20 +80 = 100

unttoietuwti Cenatuct he expuensioh te


0) )(4
*5-(4+6))

4*5e4+6))

46

4
6

(a
Ropt
tudput-3+

4) 4
tut=3+ 4*5
3

4
4
uctput +4*5~9+6]
Qput 3+4 *o-4t6

feooeytoareoual

utt +3)

utput=+3-)
A
45

+3-45
Oatfut LQusput - +3-*45t +3-*46+q

4
5*
|Qukut4 |ufect-
345
|ad
-346*9 ht 45 *96|

) -t|ad:
|tput345*46+-
+ ((d¥e+f)*g)
(a-b*c)
b45*96+|

*etf)9)
(a-t* ((d

+f)*9)
((d*e
d*et)

uthut a-b* C+ d*et


f*g
Gapesgkeytevesa

bid
+-a*be*t*de
ta/

(eatardytravensal'

(4) utyat *-
abcde*ft9*+

5)
b6

(22

12 49)
ouoox 25 20 J0 5 12 22 36 3028 40 58 48
loaoudu512 1o 22 2028 30 8 48 40 36 26
#
nedu 5 10 12 20 22 25 28 30 36 B840 48
KerelQsuoen 25
20 36
|o 2 0 40
12 28 38 49
Qus- -vite
the algaithumdoconwota tetlin
enonaien

n quss8)
25 20 05 12 22 36 b0 28 40 3848
(oado45 19 L0 22 20 28 50 b8 48 40 36 25
Un erdo 5 10 12 20 22 25 28 30 36 B8 46 48
3
Xevel Qouoou 25
20 36
|o 22 30 40
12 28 38 49
Quas- -Noita
the agvthndoeonwt
a teat{im
owpaian

Qs-(a-ae hat thacadedbnny e?Elain hu puboae


inbinau
heading ts alas'
uhat he dillisone
is
dwenanglethoncadedand double theaded kiy
tes.
d Thseadeol
Binasy dee a Kinasytae data atuctue
uhune he emtty t nd ght child sints
in a
Binesyt au uelactoly huadshat ink ede

daarosal.

comblexalybithmsand vdatt atuetis


than vogulo
DOUBLE THREADE D
SIN6LeTHREADE D
4

hatalntstoinerde
(henist)
t Jnsude udie

Qau Exlain aes


(B)- înalred
thu inthe Halfmanerdiy
abulasdecading Encadings

S O–Guate a leal oueaeh wigw chasate


node
and bušld a min hespoall
leanod CAinheafiuad

tuo nodesinnin heaf), Jetlooqiandisad uoat


vithally

-Exdact
hos nsdy uith tha mininm bugueney
-uale noaith
a new rtenal a fuauneyeyual

Make te iutctaahtolexthaetedhedl olteheld


as

nd theatyetaetd hoda assghtchilo.


daldthsnoou to min heab

te.
Hillman
NKR'nesolg
trareorhw ow doUddatng com h oot.
Maiydein an cuxite 0te the asoay
wsath 1to the asoayo
dotha ightchild,

becadisg

üght

SO- we encQudeyaJes
taxeMDal,
duoing
node,

seh0,

(-
aud

(Ouer
a Hullinantd
Constauet
the
henagatn centinu

fu thayacD
thu kllsuing
teratish o

and euny
and dedbwinihiHullnan
cods
f45
Ninkeap

hrivimun

p3
P45
C (12
D 13)
Skwalwacle 14
145

(4
16)
enal ade5
45

45

45
dna ede (55

155[

A14
Code
X12

EncodedDade
am Ai5b89, fi45
CGI2,DS15,€:l61

(6)ASJ0 0: ,
,€15,tS15, U3 T:)
4,S 1s,

4
13
16

ade
desual

A
4
13

Adesnal ode 8)
(10)
13
€ 15
15
S
16>
15

te
althan

Encodad data

I
TIO 00
8
A

You might also like