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

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

View Full Document Right Arrow Icon
Introduction to Algorithms 6.046J/18.401 Lecture 20 Prof. Piotr Indyk
Background image of page 1

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

View Full Document Right Arrow Icon
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
Background image of page 2
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 .
Background image of page 3

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

View Full Document Right Arrow Icon
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
Background image of page 4
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
Background image of page 5

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

View Full Document Right Arrow Icon
Introduction to Algorithms May 1, 2003 L20.6 © 2003 by Piotr Indyk Orthogonal segments
Background image of page 6
Image of page 7
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 Right Arrow Icon
Ask a homework question - tutors are online