Question: (a) (20 points) You given as input n real numbers x1,...,xn. Design an efficient algorithm that uses the minimum number m of unit intervals


(a) (20 points) You given as input n real numbers x1,...,xn. Design


(a) (20 points) You given as input n real numbers x1,...,xn. Design an efficient algorithm that uses the minimum number m of unit intervals [li, li+1) (1 i m) that cover all the input numbers. A number x; is covered by an interval [li, li+1) if li xili+1. Argue why your algorithm is correct (formal proof is not required). For example, consider the input for n = 4: 0.1, 0.9, 1.1, 1.555. Then the two intervals [0.1, 1.1) and [1.1, 2.1) cover all the input numbers (i.e. in this case m = 2).

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