I'm not sure what a 2 hash table is. Can you please explain ? On Tue, Oct 19, 2010 at 10:36 PM, MOHIT .... <mohit...@gmail.com> wrote:
> o(n) soln > > Lets say A is the array of length N. > Create an array "sum" of length N and initialize it to 0. > Create an array "product" of length N and initialize it to 1. > > now sum[i]=sum[i-1]+A[i]; sum[0]=A[0]; > > product[i]=product[i-1]+A[I] product[0]=A[0]; > > make a two hash table for product and sum array ; > in product arrary traverse i=0 to n ; > > divide result=product[i]/P and check result is present in hash table or not > if yes then get index of result . > suppose k then check absolute(sum[i]-sum[k])==S if yes then we got sub > array. > > else ..keep do this untill array end ; > > > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algoge...@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@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 algoge...@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.