LecXX4

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

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

1 4/1/10 COT 6936 1 COT 6936: Topics in Algorithms Giri Narasimhan ECS 254A / EC 2443; Phone: x3748 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 ± Divide-&-Conquer : ± 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 fi 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

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

View Full Document
2 COT 6936 4 1-d Post Of fi 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 fi 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) 4/1/10 COT 6936 6 2-D Range Tree ± Build the X-Tree , a balanced binary search tree on set S using the x-coordinates of the points.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern