This question is related to the famous combinatorics question on TopCoder called Jewelry
You are given an array of numbers :
$\{1,2,3,4,5,5\}$
The task is to count the number of ways that the array can be partitioned keeping in mind the sum of the two partitions must be equal, like-:
$\{1,2\} \{3\}$
I know how to solve this problem if there are no equal elements in the array. But the problem starts when there are equal elements.
The solution shows that way of counting that is given by the following expression:
comb(k,u) * waysAbove[s - v[i]*u] * waysBelow[s];
Where u is the number of equal items chosen in the first partition?
My question is as follows:
Why are we only calculating combinations for the first partition? What happens to equal elements picked in the second partition? Why are they not included?
Please have a look at the links given in the question.
If the question is not clear please let me know what other information I can include to make it clearer.