Knapsack Algorithm Using Dynamic Programming