1 Replies - 3039 Views - Last Post: 09 February 2009 - 05:34 PM

#1 airwizard   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 01-February 09

Subset sums

Posted 08 February 2009 - 04:27 AM

The problem is the following:

You are given a set of positive integers { a1 , a2 , a3 , ... , an } in which there are no same numbers ( a1 exists only once ,a2 exists only once,...) eg A = {12 , 5 ,7 ,91 }.
Question: Are there two disjoint subsets of A , A1 = { b1,b2,...,bm } and A2 = { c1,c2,...,ck} so that b1+b2+...+bm = c1+c2+...+ck ?

Note the following: It is not obligatory for A1 and A2 to cover A, so the problem isn't automatically reduced to the subset sum problem.
eg A = {2,5,3,4,8,12}
A1= {2,5} so sum of A1 is 7
A2= {3,4} so sum of A2 is 7
We found two disjoint subsets of A with the described property so the problem is solved.

How can I solve this problem? Can I do something better than find all possible (disjoint)subsets, calculate their sums and find two equal sums?

Thank you for your time.I am not asking this in order to get code(after all it is an algorithmic question) but in order to know the complexity of this problem and if it can be reduced to a known problem.

Is This A Good Question/Topic? 0
  • +

Replies To: Subset sums

#2 Gloin   User is offline

  • Expert Schmexpert...
  • member icon

Reputation: 235
  • View blog
  • Posts: 4,489
  • Joined: 04-August 08

Re: Subset sums

Posted 09 February 2009 - 05:34 PM

The Subset sum problem is an NPC problem and it appears to me that the same goes for the given problem as it has the same characteristics as the Subset sum problem.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1