Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Partition problem is well known ( http://en.wikipedia.org/wiki/Partition_problem ).

Let's add an additional condition: sizes of both sets should be equal. Is there a pseudo-polynomial solution to that problem?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Yes. Given a list $S$ of positive integers, add $\max(S)\cdot \mathrm{length}(S)$ to each element, and denote the resulting list by $S'$. Run the algorithm for the partition problem on $S'$, and accept if and only if it accepts. This is correct because partitions $S'=S'_1\cup S'_2$ are equivalent to partitions $S=S_1\cup S_2$ where $|S_1|=|S_2|$.

share|improve this answer
1  
My kudos for a nice method! I suppose that $\sum(S)$ instead of $\max(S)\cdot \mathrm{length}(S)$ is also satisfies the solution, right? –  alexander.myltsev Oct 19 '12 at 14:25
    
Yep. Another reduction would be to send $s\in S$ to $1+s\cdot \mathrm{length}(S)$. –  Colin McQuillan Oct 19 '12 at 14:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.