08 - Divide and conquer algorithms in computational geometry- finding the closest pair of points

# 08 - Divide and conquer algorithms in computational geometry- finding the closest pair of points

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

2/8/08 - Divide and conquer algorithms. .. Lecture: Divide and conquer algorithms in computational geometry: fnding the closest pair oF points Reading: Chapter 5.4 cs482-02-08-08-Audio.mp4 Closest pair oF points Given n numbers x 1 , x 2 , . .. , x n ±ind i, j such that |x i – x j | is minimized. O(nlogn): sort them. y 1 < . .. y n Compute every y i+1 – y i , take the min. Given n points {(x i , y i ): i = 1 . .. n} ±ind i, j that minimize: ±irst idea: Step 1: Sort them by x coord. Sort them by y coord. 11-1 11

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

View Full Document
Let a be the median x coordinate. Take the line L. x = a. Let Q = {pts left of L} R = {pts right of L} Step 2: Solve the Q, R subproblems Set = min{ δ Q , δ R } Step 1. Sorting (twice) O(nlogn) Step 2: Solving Q, R 2f(n/2)
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: f(m):= runtime on m points Step 3: Dealing with the strip. (nlogn) f(n) = 2f(n/2) + O(nlogn) nlog 2 (n). g(m):= runtime on m pre-sorted (by x and y) points g(m)=2g(m/2) + “Step 3” f(m) = O(nlogn) + g(m) Lemma: If p 1 , p 2 , . .. p n are points in a vertical strip of width 2 δ , where δ = min dist between pairs on the same side of the strip’s midline, sorted by y coord, and if ∃ i, j such that ǁ p i – p j ǁ < δ , then the closest such pair satisFes |i-j| ≤ 16 Make a grid of side length δ /2 Key observation: 11-2 No grid cell contains more than one point. Diameter of a grid cell is δ /2* √ 2 ̅ 11-3...
View Full Document

{[ snackBarMessage ]}

### Page1 / 3

08 - Divide and conquer algorithms in computational geometry- finding the closest pair of points

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

View Full Document
Ask a homework question - tutors are online