# lec11 - n CS 323 Lecture 11 o Design and Analysis& of...

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

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: n CS 323 Lecture 11 o Design and Analysis & of Algorithms Hoeteck Wee Â· [email protected] http://www.cs.qc.edu/~hoeteck/f09/ DIVIDE-AND-CONQUER ALGORITHMS I. closest pair of points II. integer multiplication Closest pair of points PROBLEM. given a list of n points in the plane ( x 1 , y 1 ) , . . . , ( x n , y n ) , find the pair that is closest. APPLICATIONS. graphics, computer vision, molecular modeling, etc NAIVE ALGORITHM. try all pairs of points, O ( n 2 ) time TODAY. divide-and-conquer algorithm with running time O ( n log n ) time I if n âˆ¼ 10 3 , O ( n 2 ) âˆ¼ 10 6 and O ( n log n ) âˆ¼ 10 4 I use Manhattan distance d (( x , y ) , ( x , y )) = | x- x | + | y- y | QUESTION. how to divide? I expect O ( n log n ) time from T ( n ) = 2 T ( n / 2 ) + O ( n ) I need combining step to run in O ( n ) time Hoeteck Wee CS 323 Oct 14, 2009 3 / 10 Closest pair of points ALGORITHM. divide-and-conquer 1. divide. draw a vertical line so that there are âˆ¼ n / 2 points on each side 2. conquer.conquer....
View Full Document

{[ snackBarMessage ]}

### Page1 / 10

lec11 - n CS 323 Lecture 11 o Design and Analysis& of...

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

View Full Document
Ask a homework question - tutors are online