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

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
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 · hoeteck@cs.qc.cuny.edu 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

Page1 / 10

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

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

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