Question: 2 . Class Scheduling: Recall the class scheduling problem described in lecture. We are given two arrays S [ 1 . . n ] and
Class Scheduling: Recall the class scheduling problem described in lecture. We are giventwo arrays Sn and Fn where Si Fi for each i representing the start andfinish times of n classes. Your goal is to find the largest number of classes you can takewithout ever taking two classes simultaneously. For each of the following greedy algorithms,either prove briefly explain why that the algorithm always constructs an optimal schedule,or describe a small input example for which the algorithm does not produce an optimalschedule Assume that all algorithms break ties arbitrarily that is in a manner that iscompletely out of your control Exactly three of these greedy strategies actually work.a Choose the course x that ends last, discard classes that conflict with x and recurse.b Choose the course x that starts first, discard all classes that conflict with x andrecursec Choose the course x that starts last, discard all classes that conflict with x andrecurse
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
