Question: 6. Greedy Algorithm {P1, P2, P3, ,Pn} along a real You have a finite set of points P = line. Your task is to
6. Greedy Algorithm {P1, P2, P3, ,Pn} along a real You have a finite set of points P = line. Your task is to find the smallest number of intervals, each of length 2, which would contain all the given points. For example, when P = {5.7, 8.8, 9.1, 1.5, 2.0, 2.1, 10.2}, an optimal solution has 3 intervals [1.5,3.5], [4,6], and [8.5, 10.5] are length-2 intervals such that every element is contained in one of the intervals. Device a greedy algorithm for the above problem and analyze its time complexity. You don't need to prove the correctness of your algorithm.
Step by Step Solution
3.38 Rating (142 Votes )
There are 3 Steps involved in it
To solve this problem using a greedy algorithm you can follow these steps ... View full answer
Get step-by-step solutions from verified subject matter experts
