added iterative solution for knapsack problem