My approach :
partition(n) =
1 + partition(n-1)
2+partition(n-2)
3+partition(n-3)
..
..
n-1+partition(1)
n

Assuming 1+2 and 2+1 as different.


On Mon, Mar 14, 2011 at 11:53 PM, Aviral Gupta <[email protected]> wrote:

> you can use coin change problem as one of the solutions.....
>
> Regards
> Aviral Gupta
> http://coders-stop.blogspot.com/
>
> On Mar 14, 8:43 pm, Ralph Boland <[email protected]> wrote:
> > On Mar 11, 9:33 am, saurabh agrawal <[email protected]> wrote:
> >
> > > Given an integer n , you have to print all the ways in which n can be
> > > represented as sum of positive integers
> >
> > I suggest you
> >    1)  generate the numeric partitions of  n.
> >         That's the lists of numbers in sorted order whose sum is n.
> >          e.g. The numeric partitions of  3 are: {(1,1,1), (1,2), 3}
> >    2)  For each partition generate its multiset permutations.
> >
> > Note: there is a formula for how many of sums of positive integers to
> > n
> > there are but I don't what it is.
> >
> > Regards,
> >
> > Ralph Boland
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
regards,
chinna.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to