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 non-increasing partitions of n. eg. If n=4 4 3 1 2 2 2 1 1 1 1 1 1
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.
Eg n = 5 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
As I can see its just a number split into numbers which sum up to the inputed number till all become one.