Iven an array of unsorted integers, divide it into two sets, each having (arr.Length/2) elements such that the sum of each set is as close to each other as possible
Answers
Answered by
1
Given a set of integers, the task is to divide it into two sets S1 and S2 such that the absolute difference between their sums is minimum.
If there is a set S with n elements, then if we assume Subset1 has m elements, Subset2 must have n-m elements and the value of abs(sum(Subset1) – sum(Subset2)) should be minimum.
Similar questions
Math,
5 months ago
Chemistry,
10 months ago
Math,
10 months ago
Psychology,
1 year ago
Political Science,
1 year ago
Political Science,
1 year ago