Introduction to Algorithms, Third Edition



Download 4,84 Mb.
Pdf ko'rish
bet276/618
Sana07.04.2022
Hajmi4,84 Mb.
#534272
1   ...   272   273   274   275   276   277   278   279   ...   618
Bog'liq
Introduction-to-algorithms-3rd-edition

Theorem 16.1
Consider any nonempty subproblem
S
k
, and let
a
m
be an activity in
S
k
with the
earliest finish time. Then
a
m
is included in some maximum-size subset of mutually
compatible activities of
S
k
.
Proof
Let
A
k
be a maximum-size subset of mutually compatible activities in
S
k
,
and let
a
j
be the activity in
A
k
with the earliest finish time. If
a
j
D
a
m
, we are
done, since we have shown that
a
m
is in some maximum-size subset of mutually
compatible activities of
S
k
. If
a
j
¤
a
m
, let the set
A
0
k
D
A
k
f
a
j
g [ f
a
m
g
be
A
k
but substituting
a
m
for
a
j
. The activities in
A
0
k
are disjoint, which follows because
the activities in
A
k
are disjoint,
a
j
is the first activity in
A
k
to finish, and
f
m
f
j
.
Since
j
A
0
k
j D j
A
k
j
, we conclude that
A
0
k
is a maximum-size subset of mutually
compatible activities of
S
k
, and it includes
a
m
.
Thus, we see that although we might be able to solve the activity-selection prob-
lem with dynamic programming, we don’t need to. (Besides, we have not yet
examined whether the activity-selection problem even has overlapping subprob-
lems.) Instead, we can repeatedly choose the activity that finishes first, keep only
the activities compatible with this activity, and repeat until no activities remain.
Moreover, because we always choose the activity with the earliest finish time, the
finish times of the activities we choose must strictly increase. We can consider
each activity just once overall, in monotonically increasing order of finish times.
An algorithm to solve the activity-selection problem does not need to work
bottom-up, like a table-based dynamic-programming algorithm. Instead, it can
work top-down, choosing an activity to put into the optimal solution and then solv-
ing the subproblem of choosing activities from those that are compatible with those
already chosen. Greedy algorithms typically have this top-down design: make a
choice and then solve a subproblem, rather than the bottom-up technique of solving
subproblems before making a choice.

Download 4,84 Mb.

Do'stlaringiz bilan baham:
1   ...   272   273   274   275   276   277   278   279   ...   618




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish