Reference no: EM133269866
In Python: Establish an activity selection criteria, using the greedy approach (backpack problem), choose an activity and then the next activity and so on, finish printing the longest time the processor will be active and with which selected activities it is obtained.
Do according to the following criteria:
1) There is a set S = (a1, a2,...,an) of n activities that want to use the same resource which can serve one activity at a time.
2) Each activity (a1) has a start time (si) and an end time (fi), such that: 0 <= si < fi < ∞
3) If selected, the activity (ai) and (aj) are compatible if their intervals do not overlap, that is, si >= fj or sj >= fi
4) In this problem, we wish to select a subset of mutually compatible activities of maximum size.