ohh its pretty easy i cudnt make it in the written.. nywayz thanx @nishant and @anurag
On Sun, Jul 17, 2011 at 4:35 PM, Anurag Aggarwal <anurag19aggar...@gmail.com > wrote: > take two extra arrays b[] and c[] > in b[] store the following thing > b[0]=1; > b[i]=b[i-1]*a[i-1]; > > > in c[] store following things > c[n-1]=1; > c[i]=c[i+1]*a[i+1] (i>n-1) > fill the c[] array in reverse order i.e. start from n-1 then go to 0; > > now output[] would be > output[i]=b[i]*c[i]; > > > > > On Sun, Jul 17, 2011 at 4:28 PM, geek forgeek <geekhori...@gmail.com>wrote: > >> given an array a[0......n-1] .required to find the output array out >> [0.........n-1] such that out [i] is the product of all the numbers a[0] to >> a[n-1] excluding a[i] >> for ex out[2]=a[0]*a[1]*a[3]*a[4]....a[n-1] >> constraint is not using division operator >> >> how to do this in O(n)?? >> >> -- >> 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. >> > > > Anurag Aggarwal > > -- > 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. > -- 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.