Question: Input: A set S = { ( li , ri ) | 1 < = i < = n } of n intervals denoted by

Input: A set S ={(li, ri)|1<= i <= n} of n intervals denoted by their left- and right-point over a real line L =(1, M).
Objective: Using the fewest number of colors, assign a color to each interval such that no two overlapping intervals can receive the same color. (Note that two intervals i and j when li < ri = lj < rj are not considered overlapped.)
(a) Consider the following iterative greedy algorithm. Assign color 1 to as many intervals as possible, then assign color 2 to as many intervals as possible, then assign color 3 to as many intervals as possible, etc. Does this algorithm solve the problem? Justify your answer.
(b) Now, consider the following greedy algorithm. Process the intervals in non-decreasing order of their left points, i.e., l1<= l2<=<= ln. Consider intervals in this order and assign colors such that (i) interval 1 is assigned color 1,(ii) when considering interval i, if there is an interval jsuch that j < i and the color assigned to j can be assigned to i, then assign that color to i,and (iii) otherwise, assign a new color to interval i. Does this algorithm solve the problem?
Justify your answer.

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!