Reducing time complexity of Knapsack 0~1 while using DP algorithm
问题 I'm using DP algorithm, i.e. storing sub-problem values in 2D array where one axis means n items and other - w values from 0 to W where W is the maximum capacity of knapsack. Therefore T[n-1][W] value is the optimum I need to calculate. I've read in other sources that time complexity of this algorithm is O(nW) . My quesiton would be: is it possible to reduce this time complexity even more? I found other answer which talks about pretty much same thing but I can't understant it without example: