Explain the greedy criterion. Apply greedy method for the following instance of knapsack problem. Capacity of knapsack (M) = 5.
Answer:-
Greedy Criterion: By selecting items with the highest value-to-weight ratio, we ensure that the knapsack is filled in a way that maximizes its total value.