0% found this document useful (0 votes)
6 views19 pages

Knapsack Problem Algorithms Explained

The document discusses various algorithms and optimization problems, including Prim's and Kruskal's algorithms for Minimum Spanning Trees (MST), the Knapsack problem, and the Traveling Salesman problem. It highlights the complexity of these algorithms and their applications in network design and resource allocation. Additionally, it touches on NP-completeness and approximation algorithms for solving computationally intensive problems.

Uploaded by

xeroxxwala
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)
6 views19 pages

Knapsack Problem Algorithms Explained

The document discusses various algorithms and optimization problems, including Prim's and Kruskal's algorithms for Minimum Spanning Trees (MST), the Knapsack problem, and the Traveling Salesman problem. It highlights the complexity of these algorithms and their applications in network design and resource allocation. Additionally, it touches on NP-completeness and approximation algorithms for solving computationally intensive problems.

Uploaded by

xeroxxwala
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

Prim v Kruekal

MST
Prim Ventex b0ted arY the
at a tme
many

App: Road networe


wnth
tele conmua ns
are Conncet

Aukmblemu ane talled aqan.


O Optinal Aubstru ctu
Abpnblam to acheive oprnal
Atapinn AubprttelmSam ukpnstolem
tigerlapping
4ppraches
T6- oon onauhC Mameizatam) Keepine the
Aeh urine add a mamoizatn ta bl!

fical radualy
Date
Poge.

ibnatAn

Time cTnplexilay

Lamgeit Cmmn Rubteausnu (LCS)


Alarshadl.
Knapiack pnblem
Matix chain mltiplicalien

in a Kaapiack uith qiuein Capacity .


a ud malhit nAlhiptitahm o
Bpti micu order tCopuralin
mininé
Dynae classat
Data
Knaptack Atyonithm p'rgtamming Paga

0/1 Knapcack pnblem


pobum
eapatity P : , A, S,6y*poaset prE
w ,B, 4, S wewht
i0/1

ell

, ) a10, )= a
C3,s)- (arl,):3
C36) (al, 1):3
(B,) - (3,3) =3
(u,4) (Sr0, a) =s
(4S)e (Sr0, 9) -S

(SS)- htO S)6


MCiw: mar (M [1-,w], MCi-, w-T Date

Knapsak-(bag) Pn) Page

Knapack
Tapautay
-(M) o.
(-S
aedy abt pnjiti
15

abtut

3
3

Cus) max (31[ta), 2)


-(S, A) -s
(B 10,a) -(3, a) 3

(S,6)max 4rO,):4
3,2) 3 man Cu10,5)
(6b) max I10, 4) e y
mar lltOS)S
Max pf:+6 (G,9)
Pags

-3)S)4Li)S
3))(41l,t) +5
- 3 )->(4t1, )>S
cassMate

|Lomget
Date

Common. subieauene:Tabulatibs Page

Apoach
Aeauene f chanan in a stnng

Aubitqutnw
babbah Awbiequenes
Aame val tt
valne

3 2
itb aba

eCi-1C

S AXTM

T3
cASSAte
Date
Paga

Sa ab C d£

1N
Notix chaun multipliahm
1
Rad culting ptiedem
Crin chan tblem
7ubeet patlum
(S) Chotost Pathaari thm Akitra, Bellman-fh
Minmm Apaania
N-P complutine
Appnsinatn) algeithm
O Amntiu Analyd
( ) Paral ttarithm
elassmate
Data
Paga

Maix chain muttiglieatin CMCM)

2 3

2
10 2 12 201 2

PR P3 pu Ps

chck value ftrl


if i p

min C1,A]:minCL]i mCa,2]+fal,


Date
PaqedSSmate

m
* m,2 PoPiPa 120
ma,]

I,2

m(,y
12, 23,

2
elassute
Data
Paga

A Aa AA Ay
Po P P Py

3 m(L) Ke CIL, 1)

234
m(a,8) Ke Ca, 2) 4 3
2 23
2

ma,2) m(a)1EfaP
2

m,4)

Pa laPy

ml,)
Ke Ct, 2]
Dote
Page

m(a,8), mlu,4)r P Pa Py 4P tot &213

mli,)t m(a, 4)

mlL a) ml,u) oPa Py

=168t0tS. 2,3

Aa

Aa A
A Ay
Po Pi

m(,) =t20
ma, 8) 48
alasste
Data
Paga

Diktoa Algori th n (horet path


23

TO
4
o (u) 20 < 0

dCv) dlu)t cle,u)

estinati on

|4

20

26(L
La,3.64
Page

Yo

gmphe haslng

Aouree Phootert
Beman fd tlarith (ingle patn)

then melaung

CA,8),.c)a,D).(B.E), CuE), Co e),Co,)


CE,, CcL,B).
elassnate
Data
Puga

4
CA,B)Br

(B.E) ES(6-)

Co,f):s4-f*4

CB.e) =E-0 Vertex


A -0

No apdats C-3

Tíon complexity 0ECIv|-))


o0e.v) o(n)

(4,)
J (9-4)
-6) (ro-1S
J
Date
Page
fulKerstn Alyo. ftr Naximuo Flow Probt
food.
Maximum

’Reidual qhaph

61
Ver ux ha all tulTasedqes, n
ink: ventex has all ad edaemo utusat

tda m the path


Data
Pags

Auquntiag path Bntto neck Capauty

| - -u- S 2.

12

NP .0
Hamil ce
P PHaburo' The clau o pnblum can be
Atved in ptlynmia ti'me
NP prob lem 4 Thui ahe lay of nputatirna!
pobenm that Cane Arled pelynemial
time non dulumintt machine can
Vifd n prlyAial time bya aletianmnite
machiUN,

NP Compute A dacjntn pmobem


NP
N?

time

N
Date
Page

Nondutuminsth

LAlgorithmASearch [A_n,ku)
nitil)

dating ith pttblem


Petmpulene

petyanni al Him
hih
They pidu mptmal AatuH m
anotmaahonprtblin
tminiie
cannt be
thputa
elassmute
Data

Apprsxinatin M¡g Page.

min vntu

The sptimualin problemu to Anol the eati

Nest eu

Iraxellng Aalman prnblens the


he &rtet cyele the
approximad pnbun iu fiad khast
a

rsblme that eaine neeoure


that many
Lagaithmic.
Uninsse
Date
Page

Optimualin
pMi ble but nat
lanqes than tarqett
AmA2, 44, 4, 18, S, A] Aum 9 .
Trut

sC1 3 y,y,12, S, 21 Qum o

You might also like