# lec20 - Introduction to Algorithms 6.046J/18.401 Lecture 20...

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

Introduction to Algorithms 6.046J/18.401 Lecture 20 Prof. Piotr Indyk

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

View Full Document
Introduction to Algorithms May 1, 2003 L20.2 © 2003 by Piotr Indyk Computational Geometry ctd. Segment intersection problem: – Given: a set of n distinct segments s 1 …s n , represented by coordinates of endpoints – Goal (I): detect if there is any pair s i s j that intersects – Goal (II): report all pairs of intersecting segments
Introduction to Algorithms May 1, 2003 L20.3 © 2003 by Piotr Indyk Segment intersection Easy to solve in O(n 2 ) time …which is optimal for the reporting problem: However: – We will see we can do better for the detection problem – Moreover, the number of intersections P is usually small. Then, we would like an output sensitive algorithm, whose running time is low if P is small .

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

View Full Document
Introduction to Algorithms May 1, 2003 L20.4 © 2003 by Piotr Indyk Result We will show: – O(n log n) time for detection – O( (n +P) log n) time for reporting We will use … … (no, not divide and conquer) Binary Search Trees Specifically: Line sweep approach
Introduction to Algorithms May 1, 2003 L20.5 © 2003 by Piotr Indyk Orthogonal segments All segments are either horizontal or vertical Assumption: all coordinates are distinct Therefore, only vertical- horizontal intersections exist H-segment V-segment

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

View Full Document
Introduction to Algorithms May 1, 2003 L20.6 © 2003 by Piotr Indyk Orthogonal segments
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 17

lec20 - Introduction to Algorithms 6.046J/18.401 Lecture 20...

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

View Full Document
Ask a homework question - tutors are online