GATE | GATE-CS-2005 | Question 88

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.

Task     T1  T2	 T3  T4  T5  T6	 T7 T8  T9
Profit   15  20	 30  18  18  10	 23 16  25
Deadline 7   2 	 5   3 	 4   5 	 2  7   3 

What is the maximum profit earned?
(A) 147
(B) 165
(C) 167
(D) 175


Answer: (A)

Explanation:

Task     T1  T2	 T3  T4  T5  T6	 T7 T8  T9
Profit   15  20	 30  18  18  10	 23 16  25
Deadline 7   2 	 5   3 	 4   5 	 2  7   3 

To maximize profit, we can finish tasks in following order T7, T2, T9, T5, T3, T8, T1.

We get the maximum profit as 23 + 20 + 25 + 18 + 30 + 16 + 15 = 147

Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.