Question: time interval (si, fi). Two activities can be assigned to the same room if their time intervals do not overlap. The task is to find

time interval (si, fi). Two activities can be assigned to the same room if their time intervals do not overlap. The task is to find an assignment of all activities to rooms using minimum number of rooms. (a) Algorithm A (greedy-by-room): Assign as many as possible activities to room 1 (an algorithm from the class can be used, for example), then assign as many as possible activities to room 2, etc. Does Algorithm A always solve the scheduling problem? Justify your answer. (b) Algorithm B (greedy-by-time): Initially R. Process the activities in increasing order of start times. If the current activity can be assigned to one of the rooms in R, then assign it to any such room; otherwise assign it to a new room and add this room to R. Does Algorithm B always solve the scheduling problem? Justify your answer. time interval (si, fi). Two activities can be assigned to the same room if their time intervals do not overlap. The task is to find an assignment of all activities to rooms using minimum number of rooms. (a) Algorithm A (greedy-by-room): Assign as many as possible activities to room 1 (an algorithm from the class can be used, for example), then assign as many as possible activities to room 2, etc. Does Algorithm A always solve the scheduling problem? Justify your answer. (b) Algorithm B (greedy-by-time): Initially R. Process the activities in increasing order of start times. If the current activity can be assigned to one of the rooms in R, then assign it to any such room; otherwise assign it to a new room and add this room to R. Does Algorithm B always solve the scheduling problem? Justify your
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
