0% found this document useful (0 votes)
9 views12 pages

DAA Unit 4

Uploaded by

Anubhav Sengar
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)
9 views12 pages

DAA Unit 4

Uploaded by

Anubhav Sengar
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/ 12

22 Nov 2022 TEACHER'S choice JEACHER'Schoice

Date-
Paoe 146 9P Date-
Page147

Ut DunamiC Potogsiamhalhgackiackin B.SLanan All pa Ahog fegt Pa Fl4dWaahell lgo


aund Bound
DynabaiC p.9A0.Qoaralh this paoblerm uweind he owdkett pata
2Back tenackiaq Meknodg to deign b l Oall pai
VeticeL ina giuen gA0ph
RoLAnch 3 Boud1 ne algouth t to olue all pin Ihod-egt pata pA0 L(n,
Papaie Po oaranming we AeaiAgAe an iapui adpa cEEbty usatody
1A |1 Khop9.ack peAoblem udina dhanaiPtablem
V
Ttem Weight LValue + a n d CifEE
3 foc Total
ii+fandCif)4 E
60
4-0
i k=o
224 ain(Ai dik d CK-)
iKz1
4-0 O404040R40 40
20 2
4o 4 6 o o 6o
O0 3 40 40 1o 40 L40
X60 4 O 40 4-0L00 140(40

Algo.uthm

2- 6, < 4
fo i 1ton
vLio1 D 5

2 O
7-fwL zu then
8-V i, w =yLis
qelIE 1 L 2 wtha
(OVC to] mav[iI, u,ValC,+ VC-1,o-
TEACHER'Scholce
Date
23 Nov 20 22 JEACHERSchoice
Page1A8 Date
Page 4 - d

4 4(C TSP RoLoblem Suppolehesue aoe Intcife


Ond 4aleg peuIoh usantg
3 2
pa i cLlac ciy He fs no allduaed to
E any c moi han 6hce ad has to
D coeba(k Hhe
ttayelFug taetHngeitu The
L Cot blu he cibe 4giVEn Oe
laave toiudHhe tou Salei peaia
3 2 Oith louse cos he pgoblen can be
taked in teouad efá qeaphi Tue ueatie3
aph s@peelen citiel TLe oeigktE
OMOCiaked t a cdge qiues the co4t e
5 4 taueaiug de blw Cifeaoaneoted
6 12 bythat edge
he co4t ataaUedal
olo cHe i4 Eporelented by costE
adTac en u Atoix 9bAapla
D4 O Let
6 2 veutex he tou tadtg atueocta
3 O Coep o aUETEX K beloug s fo
3 V-ER

Let SPCim) be the (eng-th e uhoectekt


p0 Jtaecfg Jeiou Uddutexigoig
lae10gh all ueectice i mexacty Cud

Qudlteo inaufiug latiueetEX

ML
CSOCVtEAcHERfchole
Date -
TEACHER Schoice
Page 1500 ate
Page S5

SP,v-ii)-M
24K
GKSRK-VTIK)
SP (3 4)=C E
SP
(4,4) CaE
9euearal-
SP (2s3 S t SP (3,) e =l6.
S(fM inCsp(JMii) SP 2,4 C24 SP(44d)= 12+=19
EMS
SP323)Cs2SP2,d= 16+6 6
SP3 43)ECs4 t SPC4, d)= 14+1-2
S 1O 15 SPAE23) = Caz tSP2,45 4+ = S
26 0 82 Sp4 3)=CAs tSP(S1o)=_20 +e =22g
tL 20
SP(2, 24)= minl Caz tSP(4)-B+2=24
LSC24 +SP (413)12+28 4o-24
SP(S2,4)FwialCs2tSr(24)1= jot 19E 222
LC4 Spt2)114+ 15=314
SP(23)=ulalECaz tSPa3)EQt16=25 s
ALCA + SP312020+ 1636

S P 1 2 , 3 , 4 = a C e t SP2.isa)=5+24= 34
C Se(31,tFlot24=34
C Sp (42,33EiS+ 25-40
1 SP s43) =3 2
0
1 2 3 4 1
S(1Pf2,3, a1)EinCSP (21i I43 5 8 14 34
jEM C3 S P (32,43)
C tSP (4i2,33),
Date-
TEACHER'schoice
Page S2 JEACHERsychoice
Date 1S3-
Page 1S3

Longe Commoh Sub tquence LCS)- ote I cLR,j-u CLi-LÄbeth ase eeual
Lnthe lohgegt coahadh Sub 9equehLe
pousblem e aue Qen ton dequehCe A BCB

SequenCe=B BA 2
haue to Jind
leugh3ulaeqjuente ad T ued in DNA matcuiuy
NE abe X= ML,N,O, M
Ea b ah bcacabe M;N, 0, M3
e baue qiven twoequen Ce M NN

X A B,CB DA B 1
Y= M o ie1 1NI
B DCA B,A 2Lo 1 1L
Sol 3 N 0 1 2 2 e2
4 0 T1 2 A3 3
A O 10 1o AfL1 tobte SM o 1 12 t3 4
2BO 111112k2 Stat
23C01L S22 r2n2
4 B OK i 2 2 3-3 MO N M
S D oiK2 t2 T 2 3 3
6AO11|122 3T34 Sequence =MNOM ong
1B K112121t 3 4|M1
TStaoc fon Heue
Matoix Chain Mutiplication (MCReieblem-=
Ciy= Mataix chain
otdeeAe
1
n engttáCel-1
RCi-,d-+ fo 1to a
4- fo <2 fo n
EACHER'Schoice
yeon154 TEACHER'SCchoice
P155

f -1
m[ii<
8- (S3 (S44)
0-
(si 1 (S,2,3)
12- etueun_m dnd L -
(S2,2) (S3,3)
Podnt Optimal PasicnSi)M
T i=j
2 - Hhen puint A9
CCALAn Aa)} As
3 - elue point (?2
4Raiut optiwmal Fana S1sii)
S-todtOptimal tasáa (5,sl7, jjt1)
6 - Paint E)'

Find Opiaal auantatiizaHonohDke ge0uente


ediwSniÍc aoe
D= (5, 4,6,21)
So
A1 Sx4
Az = 4x6 MDH MI
A3 6 K2

Mtab le Stable
TEACHER Sychoice
24 Nov 2022 Date JEACHERS choice
Page- 15% Date
Page57

LO 20 SP CI2B 43)= mihib 425 = 35


1S+25 40
36 13 12 2A3 20+27E 41

R 35 d
Sol SpL,2,3,4})= Ce+ Sp 3.4) X L0,0L,0, 10,
Ci SP (a, 2243) =0Lo, L1,0,1,O
Ci4 tSP (4,2,83)
SP (2)=C=5 O oL1iR11i1
SP(3,)=C3 6 aetnoO11k2<2s22212
Sp(4,) =Cai EleA A A) O Ri 2 t 2t2a3sk3
LO i 2 2 k33 ta ka kt-4
SP(213) = Ca t SP (3,4)= 9+6 =15 OO 2 3 3 t34|t4 4N5
SP(2,4) =Cz4 t SP (4, 4) =10 +8= 18 1O1A2 03 4 S st5
0 O t 23 4 t4Tss IhsK
SP(3,2)= C32t SP (2,4)= 13t5E 18 234T5 ts6R6
SP(5,4= C34 SP (4, )= 12+8=20
011O01
SP4,2) E CA2t SP(2,4) = 8t5 F3
SP4,3)= CA tSP (3,4)= qt6= 15
Solve o/ Knapgack peoblem uking Dunamicfarnblem
SPC23,4) minCatSP(2,43)= 4 20 =2.
C24-4SP (4 33)= 0t 15=25 Ltem 2 0E 3
SP(3, 24)= minCs2 tSP (24) = I3t18=31
C34t SP(4,2)=12 +13 25
2 3 2
SP(4213)=minCtSP2,3) = 8t LS=23 Value wt
CA3 t SP(312)= 4+18=27 2 2 2 Max 2 t5t
2 o2 3 4+
L3 l o 2 3 5s
ACHER'S cholce
2 Nov 2022 JEACHER'Sychoice
Pape56 Date
PageS
6

Backtoacking Metihad Tt is a gsuaph baasd.iketaod deo


deíalning theago.u tha in-Hi Statihg
Coumhe,
omte ledf mot cblumn tohen e placea
me faod ie explooe d a Jeasicheiee ene hecklasshe claabelwht alsrad
State Space Teee). We ast with a node andexploehe placed aueen)_Inhe uAu pibleno
ndes oa Jeasc tiee in DES Hooeue atl heande 1 we ind a 100 Jo OLich Leee
ineed not to be explose.uke Cut the bsanche the tic i4 no cloaLeg we haok hig Aow dnd
uking a deasible unction hich ibopeeatet the cbluhan 01 pa t e e golution Iwe
Condteaints o tae ptsbleba, Taig educe e tinme oho fnd Jucha sou due to clogheg
Complexit the pstoble? Backtetacking isaeci en oe backteack Ond gAetuea dalke
pocedus.e ohesue'by atesAetteuninikg thata node can Suppo3e Haat Hle queen aue placed at
eads to_notaing ieidead erdi be.goback(backtaach po4iiob Od (kJ heh the too
o he nbd.el palent andpanlaeedit ne geasuach ALeeg lie On the ganae dfago.na i aud
On the nert ehild we caflaeode ho p.ising Ohly iy T J l =K-
it oheh viiing He nodelioe detetuaine Hat it
Can hot pouibly lead to dsolutio Ofhesusige ue 2

2(A)- Queeg Reoblem- T he p.eoblem 3


pladcing auee Dnan
bX Che boa eud 90 that bol tuoo oueen atadk oee
SHate S pace
eadh 6 Hoe (ao tu0 queenß n a lahae
A couban o dagonal)lo (z=
-2

2
2 12-1

2-32=t
Dead E
13

134-
213=2 E
Read) 1Dead
d
43
Dead 4-5 (31)
La esnd Solh-1
S) Pea4 (23/

DE
s (s=

Solutiobis (21 413)


Soluticn 2 3, 4,2 E
tJEACHERScholce
Date
Pa Page166 3Ooy 20:22 Date
JEACHER'S choice
Page 6

2 (8OL Koapaack Reeblesq BackteackIg Ite P


Ex- Ttem RoAH wght P l 23 2 0
40 2 2 2 24 2
2 30 6 1S J:815
3
4
50 4 8S7
5 L6 77
= 26
So
L6
SHep-L FOn oual noPack
Step ind the lutioh ingi Fotac:iohal 4-7
khop 3.ack pAO blEpg Kaap dack= I I T 234 24+ S 625
Max fPoLot = 52-625
Khapack = 1 2 3 12 t
eiaht= 2 S+ Step 2
40+3045 15
BS2-625,
Step-2 I(boubd2=max peto 1 ) P-23

B-52625
elue
node po4o i i g P 4-7 P2
P=o May40430 10 Knapu.ackE}I,II
5 Pscet S[
3 =0
Pc2s
E40 2) PA wErq
B-S026s
P-o BE52S
B=S KuapsaL=
(211) PE3S
2 r4T A4
w+26\Bes0
P40 P 60
40
sO
M3-1 A3

DE
3)a ( P47
X. 4F
t41)|e
B
2
(
TEACHER'Sycholce
1 0 e c 202 2 2 Dec 2022 TEACHER'Schoice
Date
Pago 6 3

2 C) uba o Sulbet Reciblem Hamiltohidh ycle


Inhi pgm blepohe oe doue pdsiive_ Let G= E ) bea cOnAeeted qsaphoith an
Ateg ea13 wi (weiast3ada po:kiye Neutice,A HAmiltoiah cycle 19a9AOund1stp
integeu W ae goal toindau path long aa edge Hhe g9aph thact visit
ubset tae inteaeu oat 9ulba W eveuy Uetex once and eetusuns to t tatin
poiion
Ex- 5 , 10,12,13,15 L8
W=30
A 3

2,68 o248
21
15,358 535 J358
MzEO n31//
2214/414 A6
27,t46L 5144 17,446 54 46
AA=1 40 TA

x4,5,33 23, 533 533 5Sot 2nl


195355
1

x6 18
Sol-1
37

3S8 (C
3F So l-s
213
24,461 O414& sol- So-8
A 773 Sol- So-2 Sek3 Sol-4 Sol-1
53 2533 1533 51331
S s=I
276 18 12,6/18 16 18 1 6 18 561e
61
x4S 7 30 7, 0
So 1-2
OS
d
S8 (
=
-paqtaN Pno Pu ynv5y
9- 9- L pm
0
O
S9a
910ed
eojous.8IHOVaL
9ous.3HOVaI TTOTa
(

o
I 3 Dec 2022 TEACHER'sychoice
Date
Page68B

pa[n=3 B-21

minz0 114 15
42 443 B42

E3 B-22 B-30

Á, 3,2 4,314 A,3,5 A12 15


B-22 LB-23 B-34 1A 1
LB-4S r-367

3,2,4 3121 A1314/2 i3,41S t5,2 AAS3 2-


t37 B 3 LB-43 B34 LB-30 LBE48
C

AAS2 Fial 2-
LE-3

You might also like