Question: Problem. Design an ( n l o g n ) time algorithm ( assuming any of the usual arithmetic operations on real numbers can be

Problem. Design an (nlogn) time algorithm (assuming any of the usual arithmetic operations on real numbers can be done in constant time) that takes an unordered set L of n lines expressed as a sequence of pairs ({:ai,bi) of real numbers which each represent a line y=ai*x+bi and outputs the sequence V defining the scene. You may assume you have access to a function intersect (l1,l2) which takes as input 2 lines l1 and l2 and returns the x-coordinate of their intersection, and a function y(l,x) which computes the y-value of a given line l at the point x.(a) Give pseudocode (and/or English) to describe a divide-and-conquer algorithm for this problem. (b) Prove that your algorithm runs in (nlogn) time.

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 Programming Questions!