Greedy Algorithms
![Question 84a, 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(a): in a maximum-profit schedule A all jobs done; B T1, T6 omitted; C T1, T8 omitted; D T4, T6 omitted.](../../assets/questions/CS-2005-Q87-1.webp)
![Question 84a, 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(a): in a maximum-profit schedule A all jobs done; B T1, T6 omitted; C T1, T8 omitted; D T4, T6 omitted.](../../assets/questions/CS-2005-Q87-2.webp)
![Question 84a, 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(a): in a maximum-profit schedule A all jobs done; B T1, T6 omitted; C T1, T8 omitted; D T4, T6 omitted.](../../assets/questions/CS-2005-Q87-3.webp)
Answer & solution
Answer: D (no official key was published)
Order jobs by descending profit and put each in the latest free slot not exceeding its deadline. One resulting schedule in slots 1…7 is T2, T7, T9, T5, T3, T8, T1. Their deadlines are respectively 2, 2, 3, 4, 5, 7, 7, so all meet their deadlines. T4 and T6 are omitted, option D. In particular T2, T4, T7, T9 all have deadline≤3, so at least one of them must be omitted; T4 has their lowest profit. Only seven slots exist through the latest deadline, requiring another omission, optimally T6.
The greedy unit-job method processes larger profits first and places each job as late as its deadline permits, leaving earlier slots for tighter deadlines. It yields T2, T7, T9, T5, T3, T8, T1. Check every slot against its deadline:1≤2, 2≤2, 3≤3, 4≤4, 5≤5, 6≤7, 7≤7. T4 and T6 are absent. The three-slot deadline bottleneck among T2, T4, T7, T9 explains why a job must be omitted even before considering total capacity.