Question
Suppose you are scheduling jobs in a factory to maximize profit. In the ith week, you can choose not to do any job, do an
Suppose you are scheduling jobs in a factory to maximize profit. In the ith week, you can choose not to do any job, do an easy job with profit ei 0, or do a hard job with profit hi 0. In order to do a hard job, you must use all your manpower to gather resources for it in the previous week. That is, if you wish to do a hard job in week i, then you must choose not to do any job in week i 1. If you do an easy job in week i, then you are free to do any type of job (or no job at all) in week i 1. Your task is to come up with a schedule of the jobs to be done in each week (i.e., choose among the easy job for this week, the hard job for this week, or no job), so that the total profit is maximized. Design a dynamic programming algorithm to solve the problem optimally, In this question, you are only required to report the value of the maximum profit. For this question, assume that the input contains two arrays: e[1..n], in which e[i] stores the profit of the easy job for week i, and h[1..n], in which h[i] stores the profit of the hard job for week i. Your output is the value of the maximum profit.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started