CSE331 Lecture 33

# CSE331 Lecture 33 - > δ> δ All we have to do now Q R...

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

Lecture 33 CSE 331 Nov 16, 2011

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

View Full Document
Lecture on Monday I’ll be out of town My student Swapnoneel will cover for me
A preview of what I’m up to List Decoding: The master of disguise Practice talk: 3:15pm, Friday, Commons 9

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

View Full Document
Problems for Friday review session Bell 242, 11:30am- 12:20pm
Needs volunteers for Today

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

View Full Document
Closest pairs of points Input: n 2-D points P = { p 1 ,…, p n }; p i =( x i , y i ) Output: Points p and q that are closest d(p i ,p j ) = ( ( x i -x j ) 2 +( y i -y j ) 2 ) 1/2
A property of Euclidean distance d(p i ,p j ) = ( ( x i -x j ) 2 +( y i -y j ) 2 ) 1/2 y i x i x j y j

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

View Full Document
Dividing up P First n/2 points according to the x -coord Q R
Recursively find closest pairs Q R

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

View Full Document
An aside: maintain sorted lists P x and P y are P sorted by x -coord and y -coord Q x , Q y , R x , R y can be computed from P x and P y in O(n) time
An easy case Q R > δ All “crossing” pairs have distance > δ

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

View Full Document
Life is not so easy though Q R
Today’s agenda Taking care of life’s unfairness

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

View Full Document
Euclid to the rescue (?) d(p i ,p j ) = ( ( x i -x j ) 2 +( y i -y j ) 2 ) 1/2 y i x i x j y j
Life is not so easy though Q R δ δ > δ

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

View Full Document

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: > δ > δ All we have to do now Q R δ δ S Figure if a pair in S has distance < δ The algorithm so far… Input: n 2-D points P = { p 1 ,…, p n }; p i =( x i , y i ) Sort P to get P x and P y Q is first half of P x and R is the rest Closest-Pair ( P x , P y ) Compute Q x , Q y , R x and R y (q ,q 1 ) = Closest-Pair ( Q x , Q y ) (r ,r 1 ) = Closest-Pair ( R x , R y ) δ = min ( d(q ,q 1 ), d(r ,r 1 ) ) S = points (x,y) in P s.t. |x – x*| < δ return Closest-in-box ( S, (q ,q 1 ), (r ,r 1 ) ) If n < 4 then find closest point by brute-force Assume can be done in O(n) Assume can be done in O(n) O(n log n) O(n log n) O(n) O(n) O(n) O(n) O(n) O(n) O(n) O(n) O(n log n) + T(n) T(< 4) = c T(n) = 2T(n/2) + cn O(n log n) overall Rest of today’s agenda Implement Closest-in-box in O(n) time...
View Full Document

{[ snackBarMessage ]}

### Page1 / 18

CSE331 Lecture 33 - > δ> δ All we have to do now Q R...

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

View Full Document
Ask a homework question - tutors are online