Task: Divide given set of natural numbers into two sets the way that makes sum of numbers in two sets as close to each other as possible.
Example #1:
- Given set: {5, 30, 10, 20, 5, 10, 15, 6, 8}
- Result sets:
- {30, 10, 6, 8}; SUM = 30 + 10 + 6 + 8 = 54
- {5, 20, 5, 10, 15}; SUM = 5 + 20 + 5 + 10 + 15 = 55
Example #2:
- Given set: {217, 101, 143, 149, 139, 261, 225, 222, 239, 182}
- Result sets:
- {217, 222, 261, 239}; SUM = 217 + 222 + 261 + 239 = 939
- {225, 101, 149, 182, 139, 143}; SUM = 225 + 101 + 149 + 182 + 139 + 143 = 939
Example #3:
- Given set: {113, 184, 260, 204, 277, 175, 166, 167, 248, 103}
- Result sets:
- {103, 113, 175, 167, 204, 184}; SUM = 103 + 113 + 175 + 167 + 204 + 184 = 946
- {277, 260, 248, 166}; SUM = 277 + 260 + 248 + 166 = 951