You have a set of n integers each in the range 0 ... K. Partition these integers into two subsets such that you minimize |S1 - S2|, where S1 and S2 denote the sums of the elements in each of the two subsets.
#include <cstdio>
#include <cstdlib>
#include <string>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <string.h>
#include <limits>
using namespace std;
int ArrayMax(int* A, int size)
{
int max = 0;
for (int i=0; i<size; i++)
if (A[i] > max)
max = A[i];
return max;
}
int MaxValue(int a, int b)
{
return a > b ? a : b;
}
void DP_BalancedPartition(int* A, int size)
{
int max = ArrayMax