Algorithms | Dynamic Programming | Question 7

In the above question, which entry of the array X, if TRUE, implies that there is a subset whose elements sum to W?
(A) X[1, W]
(B) X[n ,0]
(C) X[n, W]
(D) X[n -1, n]

Answer: (C)

Explanation: If we get the entry X[n, W] as true then there is a subset of {a1, a2, .. an} that has sum as W.


Quiz of this Question

My Personal Notes arrow_drop_up