We are given a multi-set of whole numbers S of size 2n. All whole numbers in S are in the range [0, d]. We need to partition S into two multi-sets A and B such that |A| = |B| = n. Our task is to find such A and B which minimise |sum(A)-sum(B)|. What is an efficient algorithm to do so?



