This can be done using 0/1 knapsack solution.
sum up all the numbers in an array.
try to solve 0/1 knapsack where size of the knapsack is sum/2 and value is
1.we get 2 sets(say P(knapsack set),Q).
if the knapsack is perfectly filled, that is the answer.
If not, take the remaining unfilled part of knapsack(say x),
  do for all numbers in Q
   if((Q[i]-x)<x) {
     if(elem <Q[i]) {   elem = Q[i]; }
   }
 add elem to set P.

On Tue, Nov 20, 2012 at 9:57 PM, shashi kant <shashiski...@gmail.com> wrote:

> checkout these links
> http://people.csail.mit.edu/bdean/6.046/dp/   =>#7
> https://www.youtube.com/watch?feature=player_embedded&v=GdnpQY2j064
>
>
>
>
> *Shashi Kant *
> ***"Think positive and find fuel in failure"*
> http://thinkndoawesome.blogspot.com/
> *System/Software Engineer*
> *Hewlett-Packard India Software Operations.
> *
>
>
>
> On Tue, Nov 20, 2012 at 9:49 PM, shady <sinv...@gmail.com> wrote:
>
>> Hi,
>> We have to divide a set of numbers into two subsets such that their
>> difference is minimum (Balanced Partitioning Problem). Can anyone explain
>> the suggested solution ?
>> http://ace.delos.com/TESTDATA/JAN11.divgold.htm
>>
>> --
>>
>>
>>
>
>  --
>
>
>

-- 


Reply via email to