CompGeomIntro

Let yi be the y coordinate of qi for i1 to r ji 1

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ¢ Suffices to look at points in the 2k-width strip around the median line k2 k1 Divide & Conquer Scanning the strip ā¢ Sort all points in the strip by their y-coordinates, forming q1ā¦qr, r n. ā¢ Let yi be the y-coordinate of qi ā¢ For i=1 to r ā j=i-1 ā While yi-yj < d ā¢ Check the pair qi,qj ā¢ j:=j-1 d Analysis - Analysis Divide & Conquer ā¢ Correctness: easy ā¢ Running time is more involved ā¢ Can we have many qjās that are within distance k from qi ? ā¢ No ā¢ Proof by packing argument October 30, 2003 Lecture 17: Closest Pair k 6 Divide & Conquer - Analysis Analysis, ctd. Theorem: there are at most 7 qjās such that yi-yj k. Proof: ā¢ Each such qj must lie either in the left or in the right k! k square ā¢ Within each square, all points have distance distance k from others ā¢ We can pack at most 4 such points into one square, so we have 8 points total (incl. qi) qi Divide & Conquer - Analysis Packing bound ā¢ Proving ā4ā is not obvious ā¢ Wi l l p r o v e ā 5 ā ā Draw a disk of radius k/2 around each point ā Disks are disjoint ā The disk-square intersection has area (k/2)2/4 = /16 k2 ā The square has area k2 ā Can pack at most 16/ 5.1 points Divide & Conquer - Analysis Running time ā¢ Divide: O(n) ā¢ Combine: O(n log n) because we sort by y ā¢ However, we can: ā Sort all points by y at the beginning ā Divide preserves the y-order of points Then combine takes only O(n) ā¢ We get T(n)=2T(n/2)+O(n), so T(n)=O(n log n)...
View Full Document

This note was uploaded on 01/15/2012 for the course COT 5405 taught by Professor Ungor during the Fall '08 term at University of Florida.

Ask a homework question - tutors are online