Source code online books for professionals by professionals



Download 4,67 Mb.
Pdf ko'rish
bet105/266
Sana31.12.2021
Hajmi4,67 Mb.
#213682
1   ...   101   102   103   104   105   106   107   108   ...   266
Bog'liq
2 5296731884800181221

Figure 6-7.  Worst case: eight points in a vertical slice of the middle region. The size of the slice is d×2d, and each of the 
two middle (highlighted) points represents a pair of coincident points
We’re almost done; the only remaining problems are sorting by x- and y-coordinates. We need the x-sorting to 
be able to divide the problem in equal halves at each step, and we need the y-sorting to do the linear traversal while 
merging. We can keep two arrays, one for each sorting order. We’ll be doing the recursive division on the x array, so 
that’s pretty straightforward. The handling of y isn’t quite so direct but still quite simple: When dividing the data set by 
x, we partition the y array based on x-coordinates. When combining the data, we merge them, just like in merge sort, 
thus keeping the sorting while using only linear time.
Note
 

  For the algorithm to work, we much return the entire subset of points, sorted, from each recursive calls.  
the filtering of points too far from the midline must be done on a copy.


Chapter 6 

 DiviDe, Combine, anD Conquer
129
You can see this as a way of strengthening the induction hypothesis (as discussed in Chapter 4) in order to get the 
desired running time: Instead of only assuming we can find the closest points in smaller point sets, we also assume 
that we can get the points back sorted.
Convex Hull
Here’s another geometric problem: Imagine pounding n nails into a board and strapping a rubber band around 
them; the shape of the rubber band is a so-called convex hull for the points represented by the nails. It’s the smallest 
convex
14
 region containing the points, that is, a convex polygon with lines between the “outermost” of the points.  
See Figure 
6-8
 for an example.

Download 4,67 Mb.

Do'stlaringiz bilan baham:
1   ...   101   102   103   104   105   106   107   108   ...   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