Algorithem

Sep 7 2008 10:52 AM
Hello...!

I need to develop an algorithem(like a recursive function).
What I want is...if n=4, then I must print all the possibilities that can be built.
like this.....
ex:- if n=4
then answer should be
4
3 , 1
2 , 2
2 , 1, 1
1 , 1, 1, 1

as you can see all above combinations reprsents 4 when they add up(3+1=4, 2+2=4....).
As I know this is related to integer partioning.I went through some algorithems bt I couldnt overcome with a solution.Can anyone give me a solution to generate above output.?It doesnt matter you cant develop a recursive solution.if it's a recursive then it's better.
this is the site I refered: http://www.site.uottawa.ca/~ivan/F49-int-part.pdf




Answers (1)