Professional Documents
Culture Documents
Algorithon Ihot E Foasále: Prebleon Too Yevte
Algorithon Ihot E Foasále: Prebleon Too Yevte
Solve 8fooe.
esault Hhat probh,
Prebleon too Yevte
eColle!t as cphnenpvohlenm
dnation z 1o hv
Consrant:
P: A B
tya AB
wefev
S9.
ra Condion
S0
feosable Sulim: Aaty H
Opomkolkion: Achiviony objective of Ke problem
Best soltion (e:e oninfamar
Sati h tobje ctive oP H problem
Greorerol Example.
Solre ion
Algorithon brecedy (a, ) -)m eath sge Consider/
/afi'J Contosm ?/P
iHote foasále
hen e frelnde t in
oeleuha
Seeet (2x)
in,X) FollosH keom aahoads g
Fao sable&) He k olve pra
Onim
oleo
Sclutien: Slati on t X) ; he ont called it o3 Greedy.
3.
e Selech best Can
aomong al
Selee bes Gnp ame lo00 peope.
AProch. vwed attmadus, precedau oe delecf.
Covbaid pices et ho optmaor d n0pticmaL)
GrenetC Slep: se
Havinq Conslsnctod sene pat o fhe Oplimu)
olfion
m
b
m
au
Ab 7 daes t 7 ona chimes.
Yaosabb Sions
A nd An , 5,d.6e to fat 5 markies.
D
3
S 2
o
J
e