Today I have read this algorithm (in English ) , but before reading I was thinking about the problem and came to this solution. Let's sort the JOBS by the same way as it is described in the article ( i.e. by increasing order of completion) and start from the smallest. Let's keep a set of pairs (duration, index) and keep a variable 'T' which shows the sum of all the job's durations inserted in set. And if we can add our current job to set and after that 'T' will not became larger than current job's completion then insert it. Otherwise if there exist a job (in set) whose duration is greater then current duration than erase this one and insert current one. I have written this two solutions and the second one worked right for random tests. I wonder is this solution correct, and is it quite popular ( because I haven't seen it earlier ) ? And can you show problems solvable by this algorithm.
You can look at my code to understand better.
Thanks in advance !