Greedy Algorithms
![Question 84b, GATE 2005: Nine unit-time jobs T1…T9, one at a time, earn profits[15, 20, 30, 18, 18, 10, 23, 16, 25] if finished by deadlines[7, 2, 5, 3, 4, 5, 2, 7, 3], respectively. Printed 84(b): maximum profit A147; B165; C167; D175.](../../assets/questions/CS-2005-Q88-1.webp)
![Question 84b, GATE 2005: Nine unit-time jobs T1…T9, one at a time, earn profits[15, 20, 30, 18, 18, 10, 23, 16, 25] if finished by deadlines[7, 2, 5, 3, 4, 5, 2, 7, 3], respectively. Printed 84(b): maximum profit A147; B165; C167; D175.](../../assets/questions/CS-2005-Q88-2.webp)
![Question 84b, GATE 2005: Nine unit-time jobs T1…T9, one at a time, earn profits[15, 20, 30, 18, 18, 10, 23, 16, 25] if finished by deadlines[7, 2, 5, 3, 4, 5, 2, 7, 3], respectively. Printed 84(b): maximum profit A147; B165; C167; D175.](../../assets/questions/CS-2005-Q88-3.webp)
Answer & solution
Answer: A (no official key was published)
The schedule T2, T7, T9, T5, T3, T8, T1 earns 20+23+25+18+30+16+15=147. All nine profits sum to 175. At least one of the four jobs with deadline≤3 must be dropped, losing at least 18, and at least one additional job must be dropped since the latest deadline is 7, losing at least 10. Therefore profit≤175−18−10=147, attained above. Option A.
Sum the feasible schedule’s seven profits to obtain 147. For optimality, the four jobs with deadline at most 3 cannot all fit in three slots, requiring a loss of at least 18. At most seven jobs can finish by the latest deadline 7, so another distinct job must be omitted, losing at least 10. Subtract these unavoidable losses from 175 to get upper bound 147, matched by the schedule. Thus the result is proven optimal rather than just a greedy candidate.