I'm trying to solve exercise 13 from Chapter 04 of Algorithms Design (Eva Tardos) books. The problem is the following:
The way I solved: was to have a greedy solution, where I always choose, for an i, biggest wi*ti for the job to be added.
Moreover on the solutions: it is written that is the choice is biggest wi/ti.
For me then, to choose decreasing wi*ti or decreasing wi/ti is the same, so I continue the prove.
So for the prove:
- I suppose a solution
Owith an inversion, wherejis chosen beforei, and I try to show that my greedy choiceA(whereiis chosen beforej) won't augment the total weight. On this case, sinceOis an inversion andAis the correct choice,wi*ti <= wj*tj
So then before swap I can say the cost is: wi(ti) + wj(ti+tj)
So then after swap I can say the cost is: wj(tj) + wi(tj+ti)
Then since I want the cost to be less or equal after the swap, i have after <= before which is:
wj(tj) + wi(tj+ti) <= wi(ti)+wj(ti+tj).
then cutting both sides, i havewi*tj <= wj*ti
And then I block on my end of prove.
How can I get this wi*tj <= wj*ti and prove that with my swap (where wi*ti <= wj*tj) the weight is not augmented?
