maintain two arrays one left array having value left[i] =
a[0]*a[1]*a[2].....a[i-1] and one right array having value
right[i]=a[i+1]*[i+2]....a[n]  and then to get
ans[i].......ans[i]=left[i]*right[i]

On Thu, Sep 29, 2011 at 8:16 PM, Ankur Garg <ankurga...@gmail.com> wrote:

> Is the array Sorted ?
>
>
>
> On Thu, Sep 29, 2011 at 4:56 PM, raju <nikutel...@gmail.com> wrote:
>
>> Given an integer array. { 1,2,3,4,5 }
>> Compute array containing elements
>> 120,60,40,30,24 (2*3*4*5,1*3*4*5, 1*2*4*5, 1*2*3*5, 1*2*3*4)
>>
>> We shouldn't use division operator( / )
>> Time complexity O(n) .. Space complexity O(1)
>>
>>
>> ~raju
>>
>> --
>> 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.
>



-- 
*UTKARSH SRIVASTAV
CSE-3
B-Tech 3rd Year
@MNNIT ALLAHABAD*

-- 
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.

Reply via email to