0% found this document useful (0 votes)
12 views13 pages

Tut 3

DAA

Uploaded by

goyalvatsal93
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)
12 views13 pages

Tut 3

DAA

Uploaded by

goyalvatsal93
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/ 13

22 BCoN)9S

Dats:

Unit2 Tuteril ht-4


Section-A
DHausa bektn Cedy Techniue amd Dyramik
pra giaming 2
Cudy pLaach 4 mak tw becs choice at each tep
Auith u faje findlng 4 gebal sptintal sclutian t
Ltoray oßtihnal aaltien at eoch ctage ulthat
Dynadc Progammig bruaks doun a grslitm nto
Annalta hprahlema and e r each lbpreblemm
my tnce dkping it scutien:
2
Dilleuntiate blu acktaacking ond Bnanch and Rouncl

he hu technique elkciently alarchl foea sclton to


tu pcdem aneng aA aailale btini
Branch and Baund techniqe k an alginhm id to

doun iasto smallLA Bubprehlemaand b hounding


kuaactien it eliaainatel the ukprghlem That
dagen'tcontaim sptinnalscutien.
3.
Juutate t cntuctbn 4a Hufman tu fa he
feeuing Choate funciu
Chasate
A
freusney

20
22BCNU5S

Preuide The fimal pufman tu structun

(2)

kha i Dyranje pugiammi ng? leu tù ahpnozch


ailseund rem ucusilen

mallu bsblenu md sou cach obtem


emhy a teiny it soltien.
Rseuiam du nat oten aayyue untll rach to
Th fina tcge Chase cane) ano Rynone
pnagamning s mahny an atiniyaien Snfarsc
t cimple icunilon.
Calculate tew many wiays u can muuey
maticu
22 6CoN95
Daia

been psuided uith y matruces fw many uays


Camyau Ase 2
SFottt

nnaticue hae n matice>


CCn)= (2)!
Caleulate Cn)= Ca

314!

Sectien -E

Longa Conn on Sukieuune CLes) betuuh


fasuing tuo stalngs
AaGTAB
Stiny 2: axtxA YB
X T X A B

T 1 2 2

Bo 2
22BCaN9S
Date

Th 6TAB

2 Ciuen tmu maicesA tox30)BÍ 30 X5)cCsxso)


DC 60XD)E CtOXS) amd f(sxs) ltrmine
amdiluhate. tu oftiml parenthesigatien to
mininite multipliatina _Beuide o stp by
kte nunenicad solutn anc
abfereach.
Matx chain tiiatien to metice

A C
C3oxS) (SKeo) C6ox1o) oxs)
L2:
Aftox m ,2] DX30 XS
m 2,3] = 3o xS X6o gooo
m C3,J SxfoxI0-n 3o00
3o00

L3:
mC2,4]=
m, s]= 3250
m[46J= 3950
Sooo

m C2s1= Vooo
m 3,4]=334S

S:
mC2,6] 4125
n and qun) acit placnt tu dsdo
e pat Al
topmeit fetm
Algenitm. Backtracking laing
ney Sautien
fa
allaused
Are 4wn notup jiThattachahtr attack
end inplacing
foue cenitt1 pnetin Runi fous The
sltion yeu
iain billy and Jhuat mutal enuing
no
placmena qn the Brouide chusboard
psblem Qn 4- the sce Backbackingt Ahy
3
4625
mt64625
Dais
N3T £Ca 22
22 BotNu3s
Dnte:

Slutien:

Skha: 9nitialize a boasd

Thy aL lncA Attack by thy Aen (a).

2 3
X

X
2

X X

plac uen Cas)

Put Qucen (Q) at cll ,3)

X X
X Q2

3
228co NI95
Data

at now 3

Aqan bauhtiack

Seh Placu Q at (o) and w to ntei rps


Plact
3i 9: Ploc Q3 at (2,0) and ow to nttA
Plact at (3,2) and

Xx
D
Xy
X
3
X
X
2 X X

3 X

Sectian-c
a) fuplain Thu practinal fnopsack lreblen amd
cb) Canmidn a

Weight (w) Value c)


2

2 3
3
4
)2 BCaNI19S

proim. dtumnu th optinnal aclctien ikm


to xisie The tetal vaue hile not
excuding a Rhasaack kahaity e unit
Sheu you Atekby -tt Lalclahiem , imcluding
me haction me sekd item an plain

probltm Snpractinal knastackT iema art


brekn in cde st mariaipe The prslit Thi

Fractial knapsnck prcblem t can be


solud using Caialyogenithm
Sn gudy algeithm u talculate stne rahe
and accencliny e i u seet

be eelctd firsd
weime Cw) Vau (V)

krapnck Lajacity mite

Sep liD Valwe (v/w)


Data

Wiynt C) Value ty V/w


2 a3 S

S 3-0

Set Thu im in deemding sdu baucd on

Weipd Cw) Value cv)

2 S-0

3-0

Stard filing the item jn kngpiack cajacity.

knszock Weizht Ceit

(lo-1) =g (5)
(3-2)= 1
1-5=2 (9,(0,(3) 16+13= 31
2-2 =o (5)) 3) (2) 31+3:33=3433
Nea Jake foctim tm 2
e can take 2 ita ttal value

2 S 333

Tatal maximUm vaue 64 10 +15 + 333


34-33
228COU95
Date

2.a) Exlaim the oKnaptack Ercllemdtalling th


Rrobltm Atattmnt iti iilcanee , amd t
chatrnga aoiotot
Lachith

ValneCv)

2.
3 IS

Youa goal à to cuttmine e oltimmal xeletin <


to moximize Jh tetal vae uhile nat
ercUdirya trapack tapaeity o nita Yu
the o/I knapiack preblem abpreach

uignt Cwi) amd vaue CVi) asaiaka


uith it hde an alogiun a bag uh.
capacity w. Th
into th bag Ach that the m vales
asetated uitn hum The nmaxmu iHe
Note that cam eithu pt am item
cemjleely nto tu bapR Cannat put it at al

MaxiigeS hject to wiiSN


VËX
22£caNt 95
Daia:

ch wi 2, 3,5,2,)

Ling mn Li, w)Fnas mCiH,w] ,mli-L w-hfi Pci)


2 3 9
W}
6 6
2. 16 I64G 16 16 166
3 6 1691 21 21 21
16 2)25 31 31 3J
6 16 2)2S 3131 3J

Selicted itmyË wì
2
22BC0 NUSS
Dete

A A A, An, ua hh dimemiibrutu
h natlx
find tme most icins uay to.
ltily tau matica , mninijig te tetal
nuuber ultiplicatien
Prcbim ataih:

" Calculatt pnd eplaln TM poible maby aysto


pannthize Tu patsce.
Calculate nd jutiky thu cst Cno- mutiplíotion).
mttpticatin fen anch posible pauntaikation.
tu matsiceeto mininniye the total mnsbla
mtiplicctien.
. (alcwate thu aininnnaAunen of mutipli Catinu
Prouide a steh ky ste txplasntion youa
Ahprcach a d calculation.

matries be A, Az Az An_aitn ratuix


Ai raing diminuina
a mltiblyin matrices uim

Ca on) )

6
C3= S ways
Soo
ognThe elicierdly
fn
aboue
Chututed AAAAtihlcatibna
heam ia
table dp einutiplkatonA
ny Mimn. )
x(A:Au) xCAbe
cBuld Kjit ohtisal Th
dimemm uth
fa
pacduct Mathier
cxperingallv2nle The shlit To
poble kycot naim
¥ mCK+JjI+ mcickJ + min CiIr]e m
aticer pai each fo1
precducd
cempute. tomltiplkatien
eded ne scalas
=pxA Caxt
Apey
TEMOe
GNI95 228Dete

You might also like