This preview shows pages 1–18. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: > > All we have to do now Q R S Figure if a pair in S has distance < The algorithm so far Input: n 2D points P = { p 1 ,, p n }; p i =( x i , y i ) Sort P to get P x and P y Q is first half of P x and R is the rest ClosestPair ( P x , P y ) Compute Q x , Q y , R x and R y (q ,q 1 ) = ClosestPair ( Q x , Q y ) (r ,r 1 ) = ClosestPair ( R x , R y ) = min ( d(q ,q 1 ), d(r ,r 1 ) ) S = points (x,y) in P s.t. x x* < return Closestinbox ( S, (q ,q 1 ), (r ,r 1 ) ) If n < 4 then find closest point by bruteforce Assume can be done in O(n) Assume can be done in O(n) O(n log n) O(n log n) O(n) O(n) O(n) O(n) O(n) O(n) O(n) O(n) O(n log n) + T(n) T(< 4) = c T(n) = 2T(n/2) + cn O(n log n) overall Rest of todays agenda Implement Closestinbox in O(n) time...
View
Full
Document
 Fall '11
 RUDRA

Click to edit the document details