@Pankaj: You can do with a one-dimensional array since you can update the 
array one row at a time. It would look like this:
 
int P = 1000000007;
c[0] = 1; 
for( j = 1 ; j <= n ; ++j )
{
// at this point, c[i]. for i = 0, 1, 2, ..., j-1, holds (j-1) choose i
    t = c[0];
    for( i = 1 ; i < j ; ++i )
    {
        u = c[i] + t;
        if( u > P )
            u -= P;
        t = c[i];
        c[i] = u;
    }
    c[j] = t;
// at this point, c[i], for i = 0, 1, 2, ..., j, holds j choose i
}
 
Dave

On Saturday, March 3, 2012 6:44:11 AM UTC-6, Pankaj wrote:

> @jai-thanks!!! , it worked...,is there any method for big numbers like 
> 100000,in my case 1000 so storing in array[10^3][10^3] worked but what if 
> >10^5,storing will not work then??,anyway thanks a lot again!!!! 
>

On Saturday, March 3, 2012 6:44:11 AM UTC-6, Pankaj wrote:
>
> @jai-thanks!!! , it worked...,is there any method for big numbers like 
> 100000,in my case 1000 so storing in array[10^3][10^3] worked but what if 
> >10^5,storing will not work then??,anyway thanks a lot again!!!! 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/8vGDu-JB1FoJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to