I am building an xml parser in java which will handle a catalog with some books (that have price and usefulness) and I want to implement an optimum algorithm that selects the books from the catalog which have the maximum usefulness while staying within the budget.
Example:
<catalog cash=”100”>
<book usefulness=”90” price=”60” >The Art of Computer Programming</book>
<book usefulness=”90” price=”40”>Programming Pearls</book>
<book usefulness=”60” price=”40”>American Psycho</book>
</catalog>
,in this case the chosen books would be the first two books because they have a maximum usefulness of 180 and they stay in the budget.
Help would be appreciated,
Cheers