I think it can be done like this that assume that the number is represented
as 1.. like 4=1111 , 3= 111 ans so on
now if u have to fint the total number of ways then it is similar to placing
a '+' sign in the mid places
Like 3= 1 1 1 so possible are 1+11 (1+2) or 11+1 (2+1) or 1+1+1(1+1+1) hence
3 ways...!! similar approach can be taken ..
hence the problem reduces to placing + sign in b/w .. placing 1 '+' , 2 '+'
uptill the number it can be formed...!! Correct me if i am wrong..!!

On Fri, Mar 11, 2011 at 10:02 PM, saurabh agrawal <[email protected]>wrote:

> Do it assuming as two cases.
>
> On Fri, Mar 11, 2011 at 9:46 PM, Dave <[email protected]> wrote:
>
>> This is a good place to use recursion. One thing you have to know is
>> whether order matters. E.g., are 2 + 1 and 1 + 2 the same or different
>> ways to represent 3 as a sum of positive integers. This choice will
>> affect the way you write the recursive function.
>>
>> Dave
>>
>> 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
>>
>> --
>> 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.
>>
>>
>  --
> 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.
>

-- 
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