![]() |
assignment i can't solve
Hi i'm new to this place.. :o Great to be here..
anyway, i'm having this problem with an assignment i have to complete.. it's regarding a prblem called non increasing partitions of n. i have to get the output 4 3 1 2 2 2 1 1 1 1 1 1 when given the input 4.. i already have an algorithm i tried out, but the only answer it gives in the end is 4.. i believe this is a recursive algorithm.. does anyone have any idea? |
Re: assignment i can't solve
I just came up with this code.. but it doesnt work from the 3rd line onwards.. :-(
Code:
#include<stdio.h>~ |
Re: assignment i can't solve
Hey can't anyone help? it works when the n value is three... but it gets stuck from there..
|
Re: assignment i can't solve
Why don't people understanbd that code should be in the code blocks.
|
Re: assignment i can't solve
Quote:
Lakmi you can refer to thread help me to solve this problem |
Re: assignment i can't solve
I'm sorry... i'm new here.. i didn't know that code blocks are used.. :(.. this is my first day on here
|
Re: assignment i can't solve
Quote:
|
Re: assignment i can't solve
you are increasing j to often try creating a for loop with j as well inside the I loop area.
Also lthe length you have should be dynamic based on the length of N or you will never get 4 1's |
Re: assignment i can't solve
yeah.. datz the problem i'm havin.. anyway, i created a program so as to get the N from the user.. anyways, it gives the following result when n = 4 now....
4 3 1 2 2 2 1 1 1 1 1 1 It doesn't even like this for any values beyond 4.. hmmmm Anyway, it's in a presentable form now atleast for the assignment purposes.. lol.. |
Re: assignment i can't solve
is the pattern correct???i cant find any similarity in it....
|
| All times are GMT +5.5. The time now is 09:58. |