|
|
back to boardHow can I sort in this problem? Can anybody help me??? Please... Re: How can I sort in this problem? Posted by rihaz 4 Sep 2014 19:33 i think this problem can be solved using greedy algo too, sort them according to the ending time, take a time variable 't',we took the interval whose starting time is later than 't' and choose the one which ends the earliest. for example: 1-4 4-14 6-10 3-7 11-16 sorted: 1-4 3-7 6-10 4-14 11-16 here 1-4 ends the earliest, then we have a choose 6-10 (as 3-7 starting time is before 4) .... i think you get the idea. |
|
|