Suppose you had a list of numbers x1,x2,...,xn and you wanted
to divide them into sets A and B such that the sum of the
numbers in A and the sum of the numbers in B was as close as
possible. I propose solving this problem with a greedy
algorithm based on the following "greedy choice". Pick the
largest number and put it into whichever of A and B has the
lowest sum currently (place number randomly if A and B are
tied). So,
for example:
X = [3 4 7 8] A = {} B = {}
Choose 8
X = [3 4 7] A = {8} B = {}
Choose 7
X = [3 4] A = {8} B = {7}
Choose 4
X = [3] A = {8} B = {4,7}
Choose 3
X = [ ] A = {8,3} B = {4,7}
Prove that this greedy algorithm does not always yield the
optimum solution.