Lec15 - Proximity Closest pair, divide-and-conquer Closest...

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

View Full Document Right Arrow Icon
Closest pair CLOSEST PAIR INSTANCE: Set S = { p 1 , p 2 , . .., p N } of N points in the plane. QUESTION: Determine the two points of S whose mutual distance is smallest. We’ve seen a proof that CLOSEST PAIR has a lower bound for time ( N log N ). We seek an algorithm with upper bound O ( N log N ). If found, these together imply that CLOSEST PAIR θ ( N log N ). Two algorithm paradigms come to mind for O ( N log N ): 1. Sorting 2. Divide-and-conquer To use sorting, a total ordering of the points is needed, but none seem useful. For example, projecting the points of S onto the y axis give a total ordering on y coordinate but destroys useful information: points p 1 and p 2 are closest in Euclidean distance but farthest in y distance. Proximity Closest pair, divide-and-conquer
Background image of page 1

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

View Full DocumentRight Arrow Icon
Divide-and-conquer, concept Using the divide-and-conquer paradigm, time in O ( N log N ) can be achieved by: 1. Dividing the problem into two equal-sized subproblems 2. Solving those subproblems recursively 3. Merging the subproblem solutions into an overall solution in linear O ( N ) time. Unfortunately, it is not immediately obvious how to perform the merge in linear time. Suppose the problem has been solved for subproblem sets S 1 and S 2 , where S 1 S 2 = S , S 1 S 2 = , | S 1 | | S 2 | N /2; giving a closest pair of points for S 1 and another for S 2 . How can the closest pair for S be found? It may consist of one point from S 1 and one from S 2 . Testing all possible pairs of points from S 1 and S 2 requires time in O ( N /2) · O ( N /2) O ( N 2 ), which is unsatisfactory. Proximity Closest pair, divide-and-conquer S 1 S 2
Background image of page 2
d = 1, 1 We consider a divide-and-conquer algorithm for CLOSEST PAIR in 1 dimension ( d = 1). Partition S , a set of points on a line, into two sets S 1 and S 2 at some point m such that for every point p S 1 and q S 2 , p < q . Solving CLOSEST PAIR recursively on S 1 and S 2 separately produces { p 1 , p 2 }, the closest pair in S 1 , and { q 1 , q 2 }, the closest pair in S 2 . Let δ be the smallest distance found so far: δ = min(| p 2 - p 1 |, | q 2 - q 1 |) The closest pair in S is either { p 1 , p 2 } or { q 1 , q 2 } or some { p 3 , q 3 } with p 3 S 1 and q 3 S 2 . Proximity
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 07/14/2011 for the course COT 5520 taught by Professor Mukherjee during the Summer '11 term at University of Central Florida.

Page1 / 14

Lec15 - Proximity Closest pair, divide-and-conquer Closest...

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

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