use recursion c[1][1]=1; c[2][1]=1; c[2][2]=1; for(i=0;i<n;i++) for(j=0;(2*i)-1;j++) { c[i][j]=(c[i-1][j]+c[i-1][j+1]) if(c[i][j]>P) c[i][j]-=P;//dont use module because it is slow we know the value never exceede 2*P because we are adding 2 variable so just use subtract operation. } On Sat, Mar 3, 2012 at 5:56 PM, jai gupta <sayhelloto...@gmail.com> wrote:
> use pascal's triangle > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- AMRIT -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.