Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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,

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote