Source code online books for professionals by professionals


Figure 6-1.  An unbalanced decomposition, with linear division/combination cost and quadratic running time in total Figure 6-2



Download 4,67 Mb.
Pdf ko'rish
bet93/266
Sana31.12.2021
Hajmi4,67 Mb.
#213682
1   ...   89   90   91   92   93   94   95   96   ...   266
Bog'liq
2 5296731884800181221

Figure 6-1.  An unbalanced decomposition, with linear division/combination cost and quadratic running time in total
Figure 6-2.  Divide and conquer: a balanced decomposition, with linear division/combination cost and loglinear 
running time in total
Let’s try to recognize this pattern in an actual problem. The skyline problem
2
 is a rather simple example. You are 
given a sorted sequence of triples (L,H,R), where L is the left x-coordinate of a building, H is its height, and R is its right 
x-coordinate. In other words, each triple represents the (rectangular) silhouette of a building, from a given vantage 
point. Your task is to construct a skyline from these individual building silhouettes.
2
Described by Udi Manber in his Introduction to Algorithms (see “References” in Chapter 4).


Chapter 6 

 DiviDe, Combine, anD Conquer
117
Figures 
6-3
 and 
6-4
 illustrate the problem. In Figure 
6-4
, a building is being added to an existing skyline. If the 
skyline is stored as a list of triples indicating the horizontal line segments, adding a new building can be done in linear 
time by (1) looking for the left coordinate of the building in the skyline sequence and (2) elevating all that are lower 
than this building, until (3) you find the right coordinate of the building. If the left and right coordinates of the new 
building are in the middle of some horizontal segments, they’ll need to be split in two. For simplicity, we can assume 
that we start with a zero-height segment covering the entire skyline.

Download 4,67 Mb.

Do'stlaringiz bilan baham:
1   ...   89   90   91   92   93   94   95   96   ...   266




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