Greedy Algorithms
You are given an input of n real numbers xi, . . : , 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 xj is covered by an interval [li, li+1) if li <= xj< li+1. Proof is not required.
For example, consider the input for n = 4: 0.9, 0.1, 1.3, 1.555. Then the two intervals [0.1, 1.1) and [1.3, 2.3) cover all the input numbers (i.e. in this case m = 2).