closepoints

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

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

View Full Document Right Arrow Icon
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.
Background image of page 1

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

View Full DocumentRight Arrow Icon
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.
Background image of page 2
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?
Background image of page 3

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

View Full DocumentRight Arrow Icon
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
Background image of page 4
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!
Background image of page 5

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

View Full DocumentRight Arrow Icon
L If there is a pair { p i , p j } with dist ( p i , p j ) < d that is split by the
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

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 Right Arrow Icon
Ask a homework question - tutors are online