Given the weights and profits ofThe local optimal strategy is to choose the item that has maximum value vs weight ratio. This strategy also leads to a globally optimal solution because we are allowed to take fractions of an item.N
items, in the form of{profit, weight}
put these items in a knapsack of capacityN
to get the maximum total profit in the knapsack.
Recursion
Recursion is one of the most important algorithms which uses the concept of code reusability and repeated usage of the same piece of code. |
The only thing worse than being talked about is not being talked about. — Oscar Wilde |