Question: Given N lines in the plane, design an algorithm to determine if any 3 (or more) of them intersect at a single point. For simplicity,

 Given N lines in the plane, design an algorithm to determine

Given N lines in the plane, design an algorithm to determine if any 3 (or more) of them intersect at a single point. For simplicity, assume that all of the lines are distinct and that there are no vertical lines. a,x + b, = y 3lines intersect at a point a,x + b) = y When you are asked to design an algorithm, give a crisp and concise English description of your algorithm - don't write C++ code. a) [2 points] We specify a line by two numbers a and b such that a point (x, y) is on the line if and only if ax b = V. Suppose that you are given two lines ax bo = y and ax bl = y Design a constant-time algorithm that determines if the two lines intersect and, if so, finds the point of intersection. Assume that you can perform arithmetic operations with arbitrary accuracy in constant time. That is, don't worry about floating-point precision. (b) 13 points] Given an array of N lines, design an O(N) algorithm to determine if any 3 (or more) of them intersect at single point. For partial credit, design an O(N logN) algorithm. Assume that you have access to a hash table in which the insert and search operations take constant time. point] How would you modify your algorithm in (b) if you needed to output all sets of 3 (or more) lines that intersect at a single point. Output each maximal set exactly once. (c)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!