I want to calculate all binomial coeffficient upto a particular number say
1000.,like 1000C1 100C2
1000C3.......999C1,999C2......998C1................2C1 1C1.
all possible binomial coefficient out of 1000*1000 modulo 1000000007;I want
a maximum complexity of o(n^2);for 1000,i had some code of mine for the
same....but this is not O(n^2) because of while loop....i want to replace
this while loop in one step or suggest me a better algo????
p=1000000007
for(int k=1;k<=1001;k++)
{
result=1;
for (long long int i1=1;i1<=k;i1++)
{
while((result*(k-i1+1))%i1)
{
result=result+p;
}
result=(result*( k-i1+1));
result /= i1;
result=result%p;
fact[k][i1]=result;
}
}
--
Pankaj Singh
B.Tech in Computer Science and Engineering - lllrd year
IIT Roorkee, India
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
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.