Question: Algorithm to partition set of numbers into two such that difference between their sum is min and they have equal number of elements?

Solution: This problem can be solved by sorting the array in non increasing order. so array A = { 4,2,1,3,6,9}
becomes = { 9,6,4,3,2,1}
Start processing this array from the beginning and keep the sum of the elements in each of the sets upto that point. now consider next two elements at each step. assign the larger of these to the set with the smaller sum. update the sum and continue this procedure.
so here
9 | 9 3 | 9 3 1
6 | 6 4 | 6 4 2