Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Let X = {x1, x2, , xn} set of line segments parallel to the x-axis Y = {y1, y2,

ID: 674453 • Letter: L

Question

Let X = {x1, x2, , xn} set of line segments parallel to the x-axis

Y = {y1, y2, … , yn} be a set of line segments parallel to the y-axis.

No two segments in X intersect and also in Y intersect.

All intersections are only between x Xand y Y.

goal of this program: report all intersection points.

if k is the number of intersection points.

Describe a sweep-line algorithm that computes all intersection points

Time complexity: O(n log n + k)

The space complexity should be : O(n).

i) what algorithm?

ii) prove it works

Explanation / Answer

In computational geometry, the Bentley–Ottmann calculation is a range line calculation for posting all intersections in an arrangement of line segments.–Hoey calculation. It amplifies the Shamos, a comparable past calculation for testing regardless of whether an arrangement of line sections has any intersections. For an info comprising of n line portions with k intersections, the Bentley–Ottmann calculation requires significant investment O((n + k) log n). In situations where k = O(n^2/log n), this is a change on a gullible calculation that tests each pair of portions, which takes O(n^2).

The fundamental thought of the Bentley–Ottmann calculation is to utilize a range line approach, in which a vertical line L moves from left to right over the plane, meeting the data line sections in succession as it moves. The calculation is portrayed most effectively in its general position, meaning:

The Bentley–Ottmann algorithm performs the following steps: