For question 1: Take 2 arrays prod_before[N] and prod_after[N] which hold product of elements before and after i respectively
For i=1 to N-1 calculate prod_before[i] For i=N-2 to 0 calculate prod_after[i] prod_before[0]=prod_after[N-1]=1 For i=0 to N-1 prod[i]=prod_before[i] * prod_after[i] -- 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.