The Partitioning Problem: Given a set of n positive integers, partition the integers into two subsets of equal or almost equal sum. The goal is to partition the input numbers into two groups such that the difference between the sums of the elements in the two group is minimum or as small as possible.
a) (8 pts) Since no polynomial solutions are known for the above problem, implement an
exponential algorithm for finding the optimal solution for any instance of the problem and test it for small input samples. Identify the maximum input size for which an optimal
solution is possible to obtain using your algorithm in reasonable time (for example 3 hours).
Hint: Every possible partition (solution) can be represented by a binary array of size n
b)(8 pts) Implement one heuristic for solving the partitioning problem. Specify several input
cases for the heuristic for which the heuristic performs different. Your input samples should
include two cases in which the algorithm succeeds and fails to find the optimal solution
Compare the results of the heuristic to the results of the exponential algorithm using small
input samples. Also, compare the results of the two heuristics using larger input samples.
c) (4 pts) Although the general version of the partitioning problem in intractable, special cases
of the problem may have polynomial solutions. For example, assume that each of the input
integers are either x or 2x, for some positive integer x. Suggest a polynomial and optimal
algorithm for finding the best partitioning in this case?