Jul 8, 2015 at 10:29am UTC
The problem is that I have n products each product has a price and a rating(there is no relation between price and rating)and have a budget say K.I have to buy products such that the sum of rating is maximum and it does not exceed the budget.Each product can be bought only once.
Is there any well known algorithm for it ?
thanks
Jul 8, 2015 at 10:48am UTC
if there is no relation between price and rating then how can you devise an algorithm for what you want?
Last edited on Jul 8, 2015 at 10:52am UTC
Jul 8, 2015 at 11:04am UTC
what i meant was that dont assume that the product with higher rating will cost more
Jul 8, 2015 at 11:09am UTC
example
product ratings--> 46 78 12 72 90 11
product price ---> 10 13 7 12 15 8
budget--> 20
so the answer should be 78+12
Jul 8, 2015 at 11:10am UTC
you will be given two arays
Jul 8, 2015 at 11:15am UTC
this is surely incorrect
example
ratings--> 90 88 78 50
price --> 61 23 30 12
budget->65
check urself
Jul 8, 2015 at 11:38am UTC
Repeat the steps with all possible combinations (downward) until you have your maximum.
It is just an idea not the final solution.