Re: [algogeeks] Re: Re : Non Decreasing Numbers

2011-12-07 Thread tech coder
there was small mistake. correct code is int count=0; void fun(int a[],int index,int n,int i) { if(index==n) { count++; cout\n; for(int k=0;kn;k++) couta[k] ; return; } for(int j=i;j=9;j++) { a[index]=j; fun(a,index+1,n,j+1); it uses simple backtracking On Wed, Dec 7, 2011

Re: [algogeeks] Re: Re : Non Decreasing Numbers

2011-12-06 Thread shady
how to arrive at such a formulation ? can any one derive this formula ? On Mon, Sep 26, 2011 at 12:09 AM, asdqwe ayushgoel...@gmail.com wrote: that would be (n+9)C(n).. On Sep 25, 10:05 pm, shady sinv...@gmail.com wrote: @sanjay can you please tell how did you arrive at that solution ?

Re: [algogeeks] Re: Re : Non Decreasing Numbers

2011-11-05 Thread tech coder
this is the solution . it also prints all the possible as well as the total count int count=0; void fun(int a[],int index,int n,int i) { if(index==n) { count++; cout\n; for(int k=0;kn;k++) couta[k] ; return; } for(int j=i;j=9;j++) { a[index]=j; fun(a,index+1,n,j); } }

[algogeeks] Re: Re : Non Decreasing Numbers

2011-09-25 Thread asdqwe
that would be (n+9)C(n).. On Sep 25, 10:05 pm, shady sinv...@gmail.com wrote: @sanjay can you please tell how did you arrive at that solution ? On Sun, Sep 25, 2011 at 12:32 PM, Yogesh Yadav medu...@gmail.com wrote: +1 Gohana On Sun, Sep 25, 2011 at 12:28 PM, Sanjay Rajpal

[algogeeks] Re: Re : Non Decreasing Numbers

2011-09-25 Thread shady
how ? elaborate on the solution part ? how to arrive at that formulation ? On Sep 25, 11:39 pm, asdqwe ayushgoel...@gmail.com wrote: that would be (n+9)C(n).. On Sep 25, 10:05 pm, shady sinv...@gmail.com wrote: @sanjay can you please tell how did you arrive at that solution ?