@Navin: Why? No division is used. Dave On Thursday, August 16, 2012 9:20:03 AM UTC-5, Navin Kumar wrote:
> We have to consider cases when an element is zero. > > On Thu, Aug 16, 2012 at 7:07 PM, shady <sin...@gmail.com <javascript:>>wrote: > >> well we can do with just one array. Overwrite the answer directly on >> left[] array. >> >> >> On Thu, Aug 16, 2012 at 6:47 PM, mohit <mohitsi...@gmail.com<javascript:> >> > wrote: >> >>> >>> here are the steps : >>> 1) Construct a temporary array left[] such that left[i] contains product >>> of all elements on left of A[i] excluding A[i]. >>> 2) Construct another temporary array right[] such that right[i] contains >>> product of all elements on on right of A[i] excluding A[i]. >>> 3) To get OUT[], multiply left[] and right[]. >>> >>> time complexity : O(n) >>> >>> >>> On Thursday, August 16, 2012 2:26:58 PM UTC+5:30, ram wrote: >>>> >>>> >>>> Hi, >>>> >>>> This is a microsoft question asked in our campus previous year. >>>> Anyone having idea please share it here... >>>> >>>> Given an array of n elements A[n]. Write a program to create a new >>>> array OUT[n], >>>> >>>> >>>> >>>> which has its elements as multiplication of all the elements in >>>> the input array A[n] except that element (i.e.) OUT[2] = A[0] * A[1] * >>>> A[3] * ? * A[n-1]. >>>> Constraint is one should not use division operator. >>>> >>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Algorithm Geeks" group. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msg/algogeeks/-/iqyLUMLQRS0J. >>> >>> To post to this group, send email to algo...@googlegroups.com<javascript:> >>> . >>> To unsubscribe from this group, send email to >>> algogeeks+...@googlegroups.com <javascript:>. >>> 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 algo...@googlegroups.com<javascript:> >> . >> To unsubscribe from this group, send email to >> algogeeks+...@googlegroups.com <javascript:>. >> 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 view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/cOrXdXwNPUQJ. 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.