-
Improvement
-
Resolution: Unresolved
-
Major
-
None
-
Platform: All, OS: All
Try to classify axes into X and Y in a nice way so that the resulting table
would look rectangular.
This is essentially a knapsack problem and can be solved recursively with
memoization via dynamic programming:
http://en.wikipedia.org/wiki/Knapsack_problem#Dynamic_programming_solution
===============
Define a recursive function, A(i,j) to be the maximum value that can be attained
with cost less than or equal to j using items up to i.
We can define A(i,j) recursively as follows:
- A(0,j) = 0
- A(i,0) = 0
- A(i,j) = A(i-1,j) if c_i > j
- A(i,j) = max(A(i-1,j), v_i + A(i-1, j-c_i)) if c_i <= j.
===============