You are on page 1of 10

S Vewkatanamana

AIsstgmmnt
18SSIAD5H

Opimal Bimany Seamh Trte


Dne f th appucahew f Drnamic Prmnammang
test 8 treated as
tree wit miviwuw
The bway SeaTch
Seanch tee
ptimal bimay tr, w which each nod
tree is a bimany
ABmAn Seach
aw idenbifien les than idenbihers
than idenkhers
subtree are
A the idenbifien m uft
ci
foot mod
subtre a1e eat than
idenhfes mght
Att the
O TCvt mode
idevtihe at nct
on idenhfien 'x
ú present o
ehethes
To hind nale
it wot
tHon sarch m
0) X CDmpaned mou,
idonbfier at t t
les than
d1) if x
then ceach
cenich
uft jdeniher at t node,
xBqneatey than
dn) if &ubtree
Conbinues
w mghb ehere
taj,a2.an)

oidenafies
letus covs'des seb whil
<an. do, if, mt,
Seancbh fan
a44ag-
the prebabiliby successful
avd let PG1 is the tbabilits a n
1gi n qi avd
devtiher ai, 0<i4n
eaTch ow
idnbihien ,
uwuaeshd
the Cest funeiow bwany Seanch tree Ct
+To obta mode vx enttmal
have to wsent thu wwwginamy
wel) we

w BST as tw lea wodas


nwde
enteynal n o d e - L
Pakewal node O
ceavch aluop termuvnats at te mbemal
ySueteul
Mode
aloay teYnabalis at th eatemal nede
Unsuresc-hul seavehh
ceach tee ú 'nt
Total e entemal Modus w Bmany

Tolal noombemal
odus ww 6CT n
temuats at mbemal ed al evel
Sucesspal eanch
Cest constnucfon fom te mtemal oncde
Hente, enceptid

fev ai
PlevalCai)
termunals at an evtemal nod ie,
ceoTch
Uasuccesul
node fo i ú at level 0'.
a
the a uve seach extemal node S;
th
h eapecked cest of
4 (levelCk)-1)
bunamy Coarch
tree
The epecked test * (levelCki)-1))
q0)
Cest CPh ovelCai) +
(do,if uekal)
idenb hes a02 ,as)
.

OEST fov a set


ind
(o-15,0-1,p- 0S,0s
(os,01,0-bs) avd (6, n,n)-
(,Pa,P)

No fpesnble
BST 2x3c cs
3+)

beConsbn cted
BST (aw

ohil

Cdo 3
+ D.1s(4-1) + 0-1 (y-1) to 05(3-)
0-05x1 + D1 *2 +D5X3
Cest CT)
+(o 05)(-1)

.65

(do (weile

+DDS( 3-1)
O-SC3) + 0 1 C3-1)
CestT) D-I +D 5%2f D:05x +o-0s(11)

(do

(while

Dosls-4)+DiostY-H)
+o15(2-1)t 0-13-)+
Cest CT)- D.SC) +O-1(2)
+ D:DSb)

do

+0:1(3)to-1s[1-)
+ o:l(-1)-t-
D5 (y-1)+oosb-1)
0050) +D.h)
Cost)
15
do
ww

TE
y

pis(2-1)40-1(41)+o-oc(y-1)

D-js) +
Cest (1). D-G)t o-Dst 9)+ fo-o6 - 1

0BST
these Thas minimuw cest So,Ts
Awg
e 3 famula
achiae tal w
tene to
HOi,j, i<k
$(cCi,k-1)+ cCk,j5)1 +
cChj mun
Hi,j- Hj4)+ Pj)+ 4
TCj k

Cewsider av exawpl
wchilu)
, a g , ay)- Cdo,
1f, mwt,
n la, (2,3,1,),1)
qp,l,2,1,4 )=
pl,2,3, u)- (3,3,
I,1)

fnd HU Tou
we need to

chji
T o o , T 1 , 1,12y , uy
wibially

D
Too clo,o)
T t o ,o ) D

wlo,0) 2
T cC1,1)0
0,1) 0
C,1)-q)

TRR c(2,3)=D
C2,2)O

WCa,a)= q3)=1

s 3 c(3,3)-o
TC3,3)= D
w (s,3)-43)=)

Fuy cCy,)D
y,y)D
wCy,4) 4y)-

j-i
To1,p,"g3 7 s4
wCi,)-w i,j-1)+ P9)49J ickEj
3+oj),
cCtj)= min eli, E-Dt c(Ej)

Toywto,))
= w[B,0)+ py) *qu)
+343 6
k
+ w Co,) ) 0
mun clo,D) +c9,1)3
clo,1)

Co,1) l
wC,1) +P)t
(1)
haw9,2)-
3+t
3 I7 2kE2
1
cC),i)3 +w,2) ,

CU,9) mu s c,1) +
0+O+4

C1,2)
Tat oCa,s) wca,a) + po)4 43)
+1+ 1 3

cea,a)+C(3,3) 3 t oR, 3),ReE


cCa,s) muin

0t043 3
oC2,1)3
'34w3,3)4 pyt+u)
14141-3
cC5,3) + c(y,4)]+ ws,u) 32kLy
cC3,0)- min $
+0+ 3 3

Ts,u) k y

it) j-i-2
Toa, Tis 2y
83+1 = /2
Toawto,2) wtv,)) + plo)tqt)
CCo,1) mun clo,0)+ tC1,1) 3+ wto,1) 0 LL
cCo,1) 4 CL2,)

Co+4) ,St0 + 12
mun C1,9)+12 e + 1 2 11

ro,2) El
Tr3wC3)wC) +pt3) +q) 4+1-
cCt 3) mwn CCl 1 )tc(9,3) tw ( ,1) 1etEs
1eres
CC1,3)4cC1a tw , 3),
emuni +9 12
Cl3) 2 k
To4 (2,9)- wt,99 + ply)fqty) 3+1) =S
eC2,4) mn CCa, 1) +c(3,u) aLky
cCa,3) +c(4,4)t w (1,4),
To3, Th4
pCo)+ot). 1941+1:1y
o3-0(o,3)- le,1)+
cCi33) 1
tto,tCo, 0)+ (3,3) w lo,$) 0L EL3
,
l cto)+C
Cto,)+((,1)
wwcD+1
n+ 1 25
19 t D

to, 3) 2
19+1+1 -1C
y w,4) w, 3) + pu)+94)
cCt, 4) min eC1)+ cC9,4) w4),1LE
cC,1) Cc(,1)
cCI3)+ c(u,4
0+
uwng 1t1 11
12+0

C1,4)

) - i-y
Toy
J9+14= 1L
ply) 440y) =
Toy- w(v,y)- wD,1) +
minS Cto,0) +tC)) wb,u) o4 E y
CCo,u) tto,1) +c2,u)
Cco)1) tts,)
cCo 3) itC44)
mun D+19
+16

14+3

+1L
mun 19, 1, 12, 23

22

r(o,4)
w13-)
wC1,13-C,33- b,u
wo,b-
cC13CCa,3J-b ,43D
333-0Cy41:
o,0D C1D 70,1350

wC,234 wa,331|wC,y3-3
wfo,) 3- 8
3
cCo,13-8 eCha3- c C,33-3tCs,90
TCo,) 1 1 7C23 2 Ca,33 7CS,u5-y

wCo,S 1D wC,539
2 eo,1 cC1S3l eCy3-
Co,) C133 2 C2,43 14

Co,33-19 wC1411
co,93- 25 cCM3-9

wCD43 lt
c Cou31

aCoy)

Crnstnchom Dphimau bwny Seavth b

nCij 3 k Co,y3-2

TCo,13) 2,1-4
it Ck,13
4,41-0
Cpb'-b 70,13: 7(1,3) -g

TCL,1:0 0,30

wt
ALGORrTHM
geulthow oB.sr Cpp,n)

p-Satcesful probabiyb
-Unauttess hul prdoobiliby
nMo f rdanbiRien
qiven w dishinct davbi fien
as
Q4,03 Qy uur, 04,Ay
biLn
py ebabilibhe Pi3, 1Lign ord q03,
1 cCij is h test of 0BsT

opt
kj
whj 1u weight f
1
ico tp n- do
/ in hali te
ti-l-bt,5 q[is T/3-D
ti-Tl-D
cCV,13 0
wth ow wsdu
/opbi mal t
coCi,i413 qi34 qa13 +pf417,

q03+ q0413
F TCi43
eCt,f13
0
qn3 [n, n3;e
0 cn,n3: s

w[n n3
Eo n-m do
ov m:

c[i, L4) + c(r1


cij 3 w [to ) 3+

TC3
wrnt cCo,n 3, w[o, n3, 7(o, n3 )

Algothwv fimd CcT,) 3)

d
C, j+1]
=[ i , j-13
t
o m: )
) thenn
1 4 c C m - 1 +c[m,j
1 <mu
+ ( m , j3
mun c (0, m-13

You might also like