A Note Concerning The Closest Point Pair Algorithm: Martin Richards Information Processing Letters 82 (2002) 193-195
A Note Concerning The Closest Point Pair Algorithm: Martin Richards Information Processing Letters 82 (2002) 193-195
Closest Pair Problem: Given a set P of n points, find p,q belong to P such that the distance d(p,q) is minimum.
An Example:
Step.1
Step.2
Step.3
Step.4
Step.5
Step.6
Running time:
Initial sort takes O(n log n) time Each point is inserted and remove once from S -S has at most N elements, so each insertion removal take O(log n) time
Case 2:
Now we want to check distance from p to others, We set the next four point below p are A,B,C,q that py>Ay>By>Cy>qy. Let p in the left-hand side. If pq < d, q must be in the right-hand side and there are 4 cases for p,A,B,C,q. Case 1:
Case 3:
Case 4:
References [1] T.H. Cormen, C.E. Leiserson, R.L. Rivest, Introduction to Algorithms, MIT Press, Cambridge, MA, 1990. [2] U. Manber, Introduction to Algorithms, A Creative Approach, AddisonWesley, Reading, MA, 1990. [3] R. Sedgewick, Algorithms in C, Addison-Wesley, Reading, MA, 1990.