If I have a set of (edit) positive integers, and I\'m sure that the pseudo-polyn
ID: 646130 • Letter: I
Question
If I have a set of (edit) positive integers, and I'm sure that the pseudo-polynomial time algorithm for partitioning the problem will not give me an answer - what would I do next?
To illustrate this problem let's take a look at this example: {100,1,2,3}.
The p-p algorithm will give an answer False, and then I can end with result: This set can be partitioned into two set with different 106-6 = 100
(The 6 is the last result from p-p algorithm on with [_][vector.size()] = True, the 106 is the sum of all digits).
But what if I really would like to know the maximum by sum two-split of this set in which every subset has the same sum - for example the result that I'm looking for should be 3. This set - {100,1,2,3} can be split (by bypassing the 100) into two subset with the same sum - {1,2} and {3}.
How can I achieve this result?
Explanation / Answer
You can extend the dynamic programming algorithm to handle this variant. Suppose that the weights are w1,
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.