The subset-sum problem is defined as follows. Given a set of n positive integers,
S={\(a_{1},a_{2},...,a_{n}\)} and positive integer W, is there a subset of S whose
elements sum to W? A dynamic program for solving this problem uses a
2-dimensional Boolean array, X, with n rows and W+1 columns. X[i,j], \(1\leq i\leq n\), \(0\leq j \leq W\), is TRUE if and only if there is a subset of {\(a_{1},a_{2},...,a_{i}\)}whose elements sum to j. Which entry of the array X, if TRUE, implies that there is a subset whose
elements sum to W?
- AX[1,W]
- BX[n,0]
- CX[n,W]
- DX[n-1,n]