Download presentation
Presentation is loading. Please wait.
Published byAlexis Watson Modified over 9 years ago
2
Reminder: Closest-Pair Problem Given a collection P of n points in × , obtain the two points p1 and p2 such that their distance is less or equal that the distance between any two other points Brute Force: O(n 2 ) Practical Uses? Air Traffic control (3 dimensions)
3
Closest-Pair by Divide and Conquer Sort points in P by the x coordinate (O(n log 2 n)) Recursive Divide and Conquer process (O(n log 2 n)): 1.Select c that splits points in P in two equal-sized groups M and Q 2.Compute the closest pair (m1, m2) and (q1, q2) for each group M and Q separately 3.The closest-pair for P could be either m1, m2 or q1, q2 or some other pairs
4
Reminder: Convex-Hull Problem Given a collection P of n points in × , obtain the smallest convex set containing all points in P Brute Force: O(n 3 ) Practical Uses? Path finding
5
QuickHull: Convex-Hull by Divide and Conquer Sort points in P by the x coordinate (O(n log 2 n)) Select p1 with smallest x- and p2 with largest x-coordinate. p1 and p2 are in the Convex-Hull. Let p1p2 be the line connecting p1 and p2. Recursive Divide and Conquer process (worst case: O(n 2 ), average case: O(n log 2 n)): 1. Divide points in P as follows: oL: those that are to the “left” of p1p2. oR: those that are to the “right” of p1p2.
6
QuickHull: Convex-Hull by Divide and Conquer (II) 2. Find the point pL in L which is the farthest from p1p2. If tides occur, select the one that maximizes the angle between p1p2 and p1pL. pL is in the Convex-Hull 3. Find the point pR in R which is the farthest from p1p2. If tides occur, select the one that maximizes the angle between p1p2 and p1pR. pR is in the Convex-Hull 4. Repeat 1 with: op1pL and L op1pR and R As discussed in class there is an error in this algorithm. Make sure that you know the correct version (look in the book)
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.