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

Recommended Posts:

0 Average Difficulty : 0/5.0
No votes yet.