help me to solve this problem
A partition of a positive integer n is a sequence of positive integers that sum to n. Write an algorithm in psedocode and then implement the algorithm (in C) to print all nonincreasing partitions of n.
eg. If n=4 4 3 1 2 2 2 1 1 1 1 1 1 
Re: help me to solve this problem
Well, look at your example. There's a pattern there. Use that to devise your algorithm. This is your problem to solve  it's how you learn. We're here to help you with the code problems.

Re: help me to solve this problem
Quote:

Re: help me to solve this problem
Explain how you would go about solving this problem, mentally. We'll go from there.

Re: help me to solve this problem
Quote:
5 4 1 (4+1 = 5) 3 2 (3+2 = 5) 3 1 1 (3+1+1 =5) 2 1 1 1 (2+1+1+1 = 5) 1 1 1 1 1 (1+1+1+1+1 = 5) thats how we can calculate it ...i think we have to use recursive function 
Re: help me to solve this problem
Do you have any algorithm in mind to go about it?

Re: help me to solve this problem
Quote:

Re: help me to solve this problem
Quote:

Re: help me to solve this problem
Quote:

Re: help me to solve this problem
Quote:

All times are GMT +5.5. The time now is 19:21. 