greedy approach for the knapsack problem