Problem 2 There are n courses represented as time intervals (81, fi], [S2, [2], ..., [Sn, fn], where the i-th course has
Posted: Sat Nov 27, 2021 2:33 pm
Problem 2 There are n courses represented as time intervals (81, fi], [S2, [2], ..., [Sn, fn], where the i-th course has value Ci. You are trying to create a schedule of non-overlapping classes but you also value your time off between classes. Therefore, your value for a schedule is the sum of the values of the classes, plus the sum of the lengths of the gaps between consecutive classes. Design an O(nÂș) algorithm that finds the maximum possible value of a schedule of non-overlapping classes. For example, for n = 5, and intervals [7,8], [1, 2], [5,6], [1, 4], [6, 7] of values 2,6, 5, 7, 1 respectively, we can take {[1, 2], [5,6], [7,8]} of value (6 +5+ 2) + (3 + 1) = 17. =