CSE331 Lecture 33

CSE331 Lecture 33 - > > All we have...

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

View Full Document Right Arrow Icon
Lecture 33 CSE 331 Nov 16, 2011
Background image of page 1

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

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

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

View Full DocumentRight Arrow Icon
Problems for Friday review session Bell 242, 11:30am- 12:20pm
Background image of page 4
Needs volunteers for Today
Background image of page 5

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

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

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

View Full DocumentRight Arrow Icon
Dividing up P First n/2 points according to the x -coord Q R
Background image of page 8
Recursively find closest pairs Q R
Background image of page 9

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

View Full DocumentRight Arrow Icon
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
Background image of page 10
An easy case Q R > δ All “crossing” pairs have distance > δ
Background image of page 11

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

View Full DocumentRight Arrow Icon
Life is not so easy though Q R
Background image of page 12
Today’s agenda Taking care of life’s unfairness
Background image of page 13

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

View Full DocumentRight Arrow Icon
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
Background image of page 14
Life is not so easy though Q R δ δ > δ
Background image of page 15

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

View Full DocumentRight Arrow Icon
Background image of page 16
Background image of page 17

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

View Full DocumentRight Arrow Icon
Background image of page 18
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 todays agenda Implement Closest-in-box in O(n) time...
View Full Document

Page1 / 18

CSE331 Lecture 33 - > > All we have...

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

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