Question: Problem 9 - 2 You live in a country with very high medical costs and anticipate undergoing a super - expensive medical treatment for the
Problem
You live in a country with very high medical costs and anticipate undergoing a superexpensive medical treatment for the time period Luckily, as long as you have at least one job, you will have a cheap health insurance which will fully cover your expensive treatment. You are also
very smart, so you get job offers, where the th job is for the period so that the union
of fully covers the desired interval For simplicity, assume the jobs are already sorted
by their starting times, so that dots
Of course, one possible solution is to take all the jobs its OK to have multiple jobs at the same
time However, being a naturally lazy person, you would like to take the smallest number of jobs which would cover the desired interval
a points Design an efficient greedy algorithm for this problem. For partial credit, give algorithm. You will prove correctness in the next part.
b points Prove the correctness of your algorithm using a localswap argument.
c points Assume you can hold at most two jobs at the same time eg each job only has a day shift and a night shift, and you have to be at the job Does your solution from part a still work in this case? If yes, prove it Else, give a counterexample.
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
