DAA Assignment 2
DAA Assignment 2
oATE
AssIGNMENT- 02
Fxplain
Prim's alerithim. obal n'a mimum tet
cfaaniug'tu fr the guagh shoon.
60
70
50
30
V
Ie-) 2(1,46), 3, to), t- w), llustratisn.
3(\,1o) 2(-) 4(,5(-n)
c(3, so)
50
3o
G(M, E) G(V,e)
E =4
Min w=ISO
Rrin'y tlgerith
Puims alaaitmvonstua a mininim tpnring
ALGnORITHM t t G)
treu
for i< to v do
find
Suchthat y is tn V u is in V-VT
V V+ U<uty
Teten E
2. (a Wik an algoi thm to solve knapsatk protblem nin
uih
Teckiqne. Fnd fae eptmal selutioy
t hl knapack inutance n=7, m=l5
Cpl,p2,p7)-(lo, 65,15,7,6,8y3)
('Ni,N, W)= (2,3,5, 7,l,4,1)
Algeritbhm Gvady knapsack(m,n)
for i:=| n do
for i | tbn do
then nCi]: =v J ;
UATE
2 5
5 3 2
3
7 5
S
4 1
4.5 6
4
3
Cb)
(6) nz4 , m=lo, Enp;55.33
p=(40, 42,25,
40 4
12),w=(4n,5,3)
4
42 40 S;m
25 5 35
l2 4 |010
3
algoritim md kyuskal'a
2
VT
V- V,
--) b(9,s) «q ,1), de, w
illuahalien
e(a,2)
ela2)k(e,3)e (e,4),d(e,s) 2
c(e.4)d(e,4))
V=5,E
y'=V=
p'= 5-=4
drg knskals Alzorithm
Sorked oauedae
2 4
ae Ke, ec,c 2
d, taeoàb, bd, ac
4 4
be ec, çd, ed,ab,
bo, ad
4 4 c
cd, ed, ab,bd, ac
bd
4 -
s- edys4
4. Nhat u jeb szajnenng wotth dendliee! probemy?
(a it n-s'prctik (t93,'33, 4,40] amd
C,2] 60
G0+100
botb020
boti0+ 20
60t00+20
180
0-|2-3 AGE NO
DATE
Solui tn
40
33
83
tnieutlQ,v, dy)
dee-0; Deouael, s,d)
ute DeleteNincp)
SATE
Remaining vertie 2
lluctration
a-,0)
b(a2), ca,2), d(a),
e-iw) s()
2
slá,3),sc v)
d,s).
b) R
1
1
1
01
d L6
0.J
L2 o 5
2
34
5 6
4
(b)
to)
4 0
2
2 4
4 12 U 5
4
tL6 2 0
4
3 4 1T
2 5
2|6
4 12 5 34 705
2 +
46 2 3o
7
Conttrutt
data
tht Hutiwan tree fo tat
chaates A
obability 5 lo.35 o||0.4. 0.2
Iode: ) BED 4
6) A8-CO
D o.s
!A
(0.3) o-35
B
0-2 A
( 6s)
B
0.2
A
(0.65)
D-s
E A
B
o2
D
4
|2
datfllbuing
a
the theecde
ou and tee man tutf the obtain (i)
ol{ltioll0
00 |1001|00
AB_CD 6) a)BED
dlenodo
00 Smbal
A
E B
C
D
o.2
35 0
(o.65)
o65)
(15)
3 |2 |3
(2 13
13
13
T13
25
|3
4 40
4
AGF N
DATE
Prot weight No o 22 33 4 S 61 8 o
42 42 42
|2 3 12 |2 |2 42 s 42
40 4 I2 40 40 40
2S 4 C L2 40 40 40 S2 (2 2
The nent
1
b) n=4, P=(40,42, As, 2) w=l,2,|) W=s
t weight No 3 4
yo 2 40 40 40 40
2: 8282
25 2 42 2
|2 4 42 S4 g2
min
min e,:
20
(B) B
39 34
12
2 2
2
3 3 -9
2
-3
2
Skp 3 co(-))
iestl) elin)tcost6)+ast(G )+lot(sa
a problem .
wih
t (6)
with
wo 10
(to
(3
w I7
(13
SoluHonTnloir
(38
Nof.a
Not a
7solton
oluion
t434144| 134346
b’
2+3fs
bhcneh
tsplain the
i) Le Branch .
Bianch bounel asbounch
wud
miniizai2aiçn ebem But
mittae prebim kince'napta ck
the eult
conveude ed batt to tvevut.
(
oi thout
It cet Cs
qratu than pu then tillit
p-(1e,10 |21 B
,
p=-o) -te, -2-8)w=(246, 4)
U-32
PAGE No
DATE
Maxitmum prt u 3?