LecXX4

LecXX4 - COT 6936 Topics in Algorithms Giri Narasimhan ECS...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
1 4/1/10 COT 6936 1 COT 6936: Topics in Algorithms Giri Narasimhan ECS 254A / EC 2443; Phone: x3748 [email protected] http://www.cs.fiu.edu/~giri/teach/COT6936_S10.html https://online.cis.fiu.edu/portal/course/view.php?id=427 COT 6936 2 Closest Pair Problem ± Input : Set of points S in the plane ± Output : The closest pair of points in S ± Naïve Solution : O(n 2 ) time ± : ± T(n) = 2T(n/2) + M(n) ± M(n) = time to merge solutions to the two subproblems ± Only need to merge two strips on either side of vertical split ± Naïve Solutions: M(n) = O(n 2 ) ± Sort the points by y-coordinate: M(n) = O(nlogn) ± Global sorting at the start: M(n) = O(n) ± Lower Bound : O(nlogn) time ± Randomized Algorithm : O(n) time [ Rabin ] 4/1/10 COT 6936 3 Post Of f ce Problem ± Preprocess : Given set S of points in the plane representing post offices . ± Input : Query point p . ± Output : Report the closest post office to p . 4/1/10
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 COT 6936 4 1-d Post Of f ce Problem ± Preprocessing : Build balanced BST on S . ± O(nlogn) ± Alternatively, build a sorted array on S . ± Query Algorithm : Given a value p , identify the smallest value larger than p and the largest value smaller than p and among the two pick the one that is closest to p . ± O(log n) 4/1/10 COT 6936 5 2-d L ± Post Of f ce Problem ± L p = ((|a x -b x |) p + (|a y -b y |) p ) 1/p ± L 2 = Euclidean distance ± L ± = max {|a x -b x |, |a y -b y |} ± Preprocessing : Build Range Tree on S . ± O(nlogn) ± Query Algorithm : Given a value p , identify the closest point to the right of p and the closest point to the left of p and among the two pick the one that is closest to p . ± O(log n)
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/18/2012 for the course CIS 6936 taught by Professor Giri during the Spring '12 term at FIU.

Page1 / 10

LecXX4 - COT 6936 Topics in Algorithms Giri Narasimhan ECS...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online