While taking the Algorithms: Design and Analysis II class, one of the questions asks about the maximum-weight independent set problem for a path graph. shown below is a (blu
the algorithm never selects the minimum-weight vertex.
Consider: **3-100-4-1-5-100-6 it makes sense to choose 1, the minimum, since we want to choose the two 100's
The algorithm always selects the maximum-weight vertex.
Consider: 5-99-100-99-7
It makes sense to exclude the maximum in favour of the to 99's
For both these examples, try see what the algorithm would do and why it works.
A good way of reasoning about these types of problems is to try all permutations of (0,0,0,1,1,1,2,2,2,3,3,3,99,99,99,100,100,100) and it should give you most of the posibilities.