{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

closepoints

closepoints - CMSC 451 Closest Pair of Points Slides By...

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

CMSC 451: Closest Pair of Points Slides By: Carl Kingsford Department of Computer Science University of Maryland, College Park Based on Section 5.4 of Algorithm Design by Kleinberg & Tardos.

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

View Full Document
Finding closest pair of points Problem Given a set of points { p 1 , . . . , p n } find the pair of points { p i , p j } that are closest together.
Goal Brute force gives an O ( n 2 ) algorithm: just check ever pair of points. Can we do it faster? Seems like no: don’t we have to check every pair? In fact, we can find the closest pair in O ( n log n ) time. What’s a reasonable first step?

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

View Full Document
Divide Split the points with line L so that half the points are on each side. Recursively find the pair of points closest in each half. L d left d right
Merge: the hard case Let d = min { d left , d right } . L d left d right d would be the answer, except maybe L split a close pair!

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

View Full Document
Region Near L If there is a pair { p i , p j } with dist ( p i , p j ) < d that is split by the line, then both p i and p j must be within distance d of L .
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 12

closepoints - CMSC 451 Closest Pair of Points Slides By...

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

View Full Document
Ask a homework question - tutors are online