We are given 9 tasks T1, T2... T9. The execution of each task requires one unit of time. We can execute one task at a time. Each task Ti has a profit Pi and a deadline di Profit Pi is earned if the task is completed before the end of the dith unit of time.
Are all tasks completed in the schedule that gives maximum profit?
Answer: (D)
Sort the tasks by profit, highest first. For equal profit put the later deadline first (T5 before T4). Put each task in the latest free slot at or before its deadline. If no such slot is free, leave the task out. Slot k means the time from k−1 to k. The latest deadline is 7, so there are 7 slots.
T2 cannot use slot 2 (taken by T7), so it takes slot 1. T4 has deadline 3, and slots 1, 2 and 3 are already full, so it is left out. T8 takes slot 7 and T1 takes slot 6, so slots 1 to 7 are now full. T6 has deadline 5, and slots 1 to 5 are full, so it is left out too.
The profit is 30+25+23+20+18+16+15=147. Only T4 and T6 are left out.