Knapsack Problem ( Memory Optimised )