# Help in understanding Balanced Partition Algorithm

**URL:** <https://forum.kirupa.com/t/help-in-understanding-balanced-partition-algorithm/328955>\
**Category:** programming\
**Created:** [July 6, 2012, 8:10am UTC](https://forum.kirupa.com/t/help-in-understanding-balanced-partition-algorithm/328955 "2012-07-06T08:10:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![touches](https://avatars.discourse-cdn.com/v4/letter/t/77aa72/32.png) [@touches](https://forum.kirupa.com/u/touches)\
**Post date:** [July 6, 2012, 8:10am UTC](https://forum.kirupa.com/t/help-in-understanding-balanced-partition-algorithm/328955/1 "2012-07-06T08:10:45Z")

</div>

Hi all

I have some real trouble trying to first read the algorithm for the balanced Partition Problem and then trying to understand it, as i find to be unique among those who have this unusual skill of lacking a sense to read and understand algorithms.  
Every forum on the topic of the balanced partition problem has a link to MIT’s tutorial video on it. the link is [URL=“[http://people.csail.mit.edu/bdean/6.046/dp/](http://people.csail.mit.edu/bdean/6.046/dp/)”][http://people.csail.mit.edu/bdean/6.046/dp/](http://people.csail.mit.edu/bdean/6.046/dp/)

For any n integers a1…ak split into two parts such that their difference of their sum is minimum. I get the idea on how this works (i.e) Given N integers eg:5 8 13 27 14 the minimum sum is 3 as (13+8+14)-(5+27)=3[URL=“[http://people.csail.mit.edu/bdean/6.046/dp/](http://people.csail.mit.edu/bdean/6.046/dp/)”].

In the video above i don’t understand the derivation of how P(i,j)=1 if there is a subset of values a1…ai having a sum j and 0 otherwise and how to split the range of “i” in P(i,j) to 1…n and j to 0…nk?  
I dont first understand the derivation and i am clueless on translating p(i,j)  
It would be of great help if anybody could explain the derivation and the maths behind it with examples and i could use that to code the solution.

Cheers :thumb:[](http://people.csail.mit.edu/bdean/6.046/dp/)
