DAA Notes
DAA Notes
ixc tG)scz)
Bnanch bound Shat
is ah "dlgonithm Let ecz) =lowen bourd bound on the cast
dasign paradicgn which is Let b the uppe
gnaally tsed
sad enon solving eombintie Combinatolal optimizati. thot noce
poblems Thase probcms ahe typically xponential in tns tuppe then k;ll
S C1) sca) <upph.
ampaity
In wonst may xeqaie cxploing all pasible peamaati,e
Pounding &ued fos minimizatiaa paclblkm
Case
* Bounding
Boundi ah£ Used to avoid the
subthe that do not contain answer. node. genenation d
For any minization problem Suppase (1) an answes nde
with cost c1). Qun paobl rm is h ind min cost dns node
Leb I) lowé bound
boundsgrzat, than upen bond., we
l not zglone that paat
dassta
Pag
c2)(o).
C :-2 ixiAhactional. Pa_t) 38 <-32
U=-32 |)-(lotI2+
18X) -36
C0-38
U-32
Now we haye 3 biv hode.
U-22
Co -32.
U--32 U=-22 -32 38
c-36 -36
-20
C-20
Toor 50
+18) = -38
Uioz -(0+10
Uykuppeh
- 33 <-32
c3) - 32.
Kill node C3)
Kill node 1!
KiL node 5
Ans ) (1.
Cannot kill 1 LF
C=-39 C=-32
Now we have 2 live nodes
FIFO BB U=-32
Lo C=-38 C-30
6
Ua = s -(lo +10412 t1s) Not possible as_it excad W 2 38
U=-32
9-38
sapscity uppLa, = -32
ft3
2(a)-PixL
>-32 -(10 +10 +12 +I8 x2 -38
Co = -(lo +10 +12TB-8 32
z(i0+ 10+12)-32
9i-32uppen 33)
Kill node g
Ce-(ot0+12+ 13)3)=3R
ony 1 iv node z
Now we ha Ds-Cyo t2)=-22
Page
52
18)=-38
Ui2= -CIo +I0 +18)=-32
Cn=-( lo+Jo +
Us= -22
Us=-io +n)=22
Kil node13
Uz=-12+13) -30 Ans
Cuà-32 ZuppL
Kill node L
Uy = - Jo+[o+12) =-32
Cu =-I0+1o+12)=-32
clsssna
clsse
toqe S
Date
Page
55
1)C25
Eg) Adjaancy Matix fon the gnaph C=35 31
20
Redsction C)= 21 +4= 25
30
36
-2 28
2 22
18 Cen z 25 52(
|6
MBMi2
Step ) Ro heductioh:
Select mìn val no each mo
36 2 Hehe no ow { columa had oction
2
8 2
o
2 4 12
3 12
18 3
16 16
21 Lost
subthact min
20
MR’Mig.
13 GO 2
St R Ca= 3 to 1 =co
16
12
Column heduction o8
|2 )2 ) cos
2o
2
zh th
12 2.
Mr 2,
3
3 12
l2
28
2
+0
3+25
is
) staht (as
88888
12
12
SO 31
Reduction Column tìon heduc Row
12
12
1)+29+ N2 3
12 12
CO
heduction Row 1=0 to 5 8 CsRi=e Set
MRMs
25
3 o8o
2
12
2 3
12
= 1 to 3 = RSet
57
Doge 58
8
Roy heduction
88
8
GO
S2
M42 M2s
Set
GO
23
clsss
Data
Page
2y3/24
pPhobie ms in P tim
* bw NDTM solve yon NP pxoblems
Non. Detzrministi agonth
S Wihite othee 'poblem (Reduction )
SoluL 1 problen f alate
Fo i-1 to n du
W W+Li)* w[i1
'se SuccAssO,:
clhssante
nat 22 3 21,
Foge 62
Da
L3=0
(oVo Vo (Iv vo
SATdol1 knapsuck
classte
Dat
Page
wh
iem). Pis]= =P[33)
1<7
1
clse
JLL1]=o
420
Lse 2<7
5Z
JLL2]= 3 1
Dat
ug 67
)Doi
Dogr 66
2) P= ababd
Jse.
2 JLLL] =0
X 3A b
2 0 2
lse
2 56Z 9 10
2 3
67 9
Qa bc d qabe
a==d
JL L2] = 1 2 34 5 6 78 9
b a a c d
2)=3,
J[3]= 2
clssLe
)Dat 69
else
Pat L4l4tatL/]
b
E O 1 2
Qq b a aa c
index 1 2 S
C b
tt
PatLj]t txli]
J
02. 2
a a a b
7
2 3
b Pati; stxtli)
Pat Ljetxt Li)
7|
GT A G
b _qa a b a a a b a aqC
aa q baaqc
Bad Mate Chonacten, Shyt Valu.
G
9-o-l =#,þI,1
9-|-1=7
PatL =xtli] A 9-2-1 6
Pat Lj] =txtLiJ
Fon
i12,43s.
Pat Lj)=txtLil st
chana ctes postion
in text
desan! t match ,sht by sht vale
PatLj] txtli]
I any pas itian othe than
st position dosent match, sht
4-7=1 pattus.
Pottern found at
dessnte
clssmte
Date
Page 72
(asi
The numbes d chanactens matchad belo a misnatch cscuns
poeseni Sonme wboh un matahd cha¡acty (it. asa
Foh Text hojeh bad chasacter
toble
Case2
Only slix mathd chanactes belona miatched. CCUNSy Qhe
2 34 S 6 7 8 9
Eg o 2 3h 5 7
2
G A G
9 Bad Mateh Chahacen
3 0 B) 1
Sht valut
Case 2 2 34 5
2. 3
7%01=7,ky2
8-l-|2#,T-=4,2, 1
G A 5 6 7
99
C
bb
6
3 21
o
5_6778
esste
babab
b
xFasten
Randonizd Algcaithbm (Type of non-detamin ist ic Algp
Omputati on s Compahed to detenministic alo
6 4 5 6 Z 7_S
bab
baba input,it will give ditgeaht autpot
Monto Caho Alaohi hs
023 5 67 Las Vegas Algorihm.
78 More Caslo Algeni thg lenk Baad on Lawo lange number)
Paobability
)Uncentainity
Ale Some tim. it may pnoduce incohhact nesult based n
a bha blab shipt by &mte It will take same tine to Kecute algoaithm evLy tìmL
ab ba bab
shit by
-1 3 45 shit bys Ootcom Bhebt Phoba blastic
a bbabab Timt. Compleaity -detaminstic
*Las Ve¡as Algonitan
Fon tuxt ’ check bad chaactz tabe st chah utcom - Cohhect
Fo patteah -check s H
Trng compluxity will always vaay