@atul-its nice one, but its complexity is probably greater than o(n^2)
just to calculate one mCk,i want a sequence of all mCk in a
less complexity
i tried for some code which calculate all mC1,mC2..mCk in less
complexity.this works good till (1000000)Ck ;
if while loop can be reduced i can get a good algo..of o(n)..any suggestions!!!
thnks for your help!!
main
{
cin>>m>>k;
result=1;
for (long long int i1=1;i1<=k;i1++)
{
while((result*(m-i1+1))%i1)
{
result=result+p;
}
result=(result*( m-i1+1));
result /= i1;
result=result%p;
m1[i1]=result;
}
--
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.