if I have a backpack with a weight limit of W, the item is Limit K and I have N elements, N> = k
I know how to maximize it, having a 3-dimensional memory array m [N] [W] [K] (N elements to consider, W weight on the left, K elements that can be selected) and, thus, do it in O ( N * W * K), but is there a way to do this even faster in a two-dimensional memory array and achieve faster complexity, something like O (N * W) complexity?
source
share