make a table:
------------------------------------------------
pr. no. | | | |t5 |t3 |t1 |t8 |
deadl | | | | | | | |
-----------------------------
1 2 3 4 5 6 7
Start from RHS. Select task with 7 as deadline and max profit. So it is t8.
Now look for tasks with deadline >= 6. Select one with max profit, it is t1.
deadline >= 5. we have t3. deadline >= 4 here opts are t7 and t5. we select t5.
and so forth.
We get sequence as t2,t7,t9,t5,t3,t1,t8.
I hope u understand
--
-----------------------------------------------------------
I dont need drugs, I get high with Music!
-----------------------------------------------------------