[algogeeks] Re: Sets having sum equal to N

2007-05-09 Thread me13013
Cool_Happy wrote: > Suppose u r given a positive number N. > How will we find a set of distinct positive numbers having sum equal > to N. > There could be multiple such sets so what is the algo to find all > those sets. As one poster wrote, you're just looking to find all integer partitions (with

[algogeeks] Re: Sets having sum equal to N

2007-05-07 Thread Peeyush Bishnoi
I hope this solution will find the all the subsets from set S . The sum of elements in subset is equivalent to certain no. k. fun(int a[],int k){ int i,j; int k1; for(i=0;i<10;i++){ k1=a[i]; j=i+1;

[algogeeks] Re: Sets having sum equal to N

2007-04-30 Thread Shalin Shah
> Suppose u r given a positive number N. > How will we find a set of distinct positive numbers having sum equal > to N. > There could be multiple such sets so what is the algo to find all > those sets. Yes, this is the subset-sum problem but all is not lost. There is a dynamic programming soluti

[algogeeks] Re: Sets having sum equal to N

2007-04-30 Thread BiGYaN
This is a Subset-Summation problem which is proven to be NP-Complete. So there are no ways that you can devise a clever algo to solve it accurately. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks"

[algogeeks] Re: Sets having sum equal to N

2007-04-30 Thread shalinmangar
Google search for Integer Partitions. On Apr 30, 9:04 am, Cool_Happy <[EMAIL PROTECTED]> wrote: > Suppose u r given a positive number N. > How will we find a set of distinct positive numbers having sum equal > to N. > There could be multiple such sets so what is the algo to find all > those sets.

[algogeeks] Re: Sets having sum equal to N

2007-04-30 Thread pramod
If I understand correctly this is subset-sum problem and is NP- Complete. On Apr 30, 9:04 am, Cool_Happy <[EMAIL PROTECTED]> wrote: > Suppose u r given a positive number N. > How will we find a set of distinct positive numbers having sum equal > to N. > There could be multiple such sets so what