# Split a set of numbers into 2 sets, where the sum of each set is as close to one another as possible

Given a set of numbers, I'd like to split this set into 2 sets, where the sum of each set is as close to equal as possible. How would I go about doing this in a programmatic way?

Thanks in advance for any help!

EDIT: reworded for clarity perhaps?

"Given a set of integers, find a subset whose sum comes as close as possible to half the total of the entire set, without exceeding said total"

-
Have a look [here][1]. [1]: stackoverflow.com/questions/6597180/… –  Shai Covo Aug 2 '11 at 15:42
Thanks! That helps a lot –  alex heyd Aug 2 '11 at 15:47
@anon: That automatically happened after I tried to post it as an answer... –  Shai Covo Aug 2 '11 at 15:49
find the average, then go greedy –  yoyo Aug 2 '11 at 15:56
@Shai: Pressing the hyperlink button in the WYSIWYG editor for the answer box will automatically create a non-inline link. In comments, I think only inline links work, and the markup is [text](http://url). –  anon Aug 2 '11 at 15:57