Implementaion using Knapsack Algorithm