Talk:Subset Sum

From Algorithmist
Jump to: navigation, search

Isn't Problem B a special case of problem A? (Namely, deciding whether the answer in A is 0 or not, instead of actually finding it.) Not sure how that's relevant though, just an observation. Aboyner 14:13, 20 Dec 2005 (EST)

Yes, there are definitely overlaps, and I probably should put the more specific (and presumably easier to understand) first, since all "B" is asking is if the count is > 0..

Feel free to edit, I'm not sure what the best way to write things is either! --Larry 14:17, 20 Dec 2005 (EST)

[edit] ai values

Are ai values supposed to not ever be lower than zero? What happens to equation c(i,j) = c(i - 1,j) + c(i,j - ai) when either i - 1 or j - ai get below zero, or one is zero but the other is not (value (0,0) is not reached yet)? If the answer to first question is "yes", then the answer to the second one is easy and should be incorporated to the text? I guess this is the case, otherwise it may result in an infinite number of different ways to get the final result.


It depends on the exact problem -- you're right in that there would be infinite number of different ways to get the final result if each ai can be used as many times. If each ai can only be used once, you can modify the recurrence slightly to make it work. I will change the problem to reflect that more accurately.

Larry 12:24, 17 February 2012 (EST)

[edit] k_i \in (0, 1)???

Last section: I believe you mean k_i \in \{0, 1\} rather than k_i \in (0, 1).

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox