sorry, one mistake...
mul = mul*A[i];

it should be

mul = mul*A[i+1]


On Fri, Sep 30, 2011 at 2:57 AM, Piyush Grover <[email protected]>wrote:

> Given array A.
>
> Compute array B such that
>
> B[0] = 1;
> for(i = 1; i < n; i++)
>     B[i] = B[i-1]*A[i-1]
>
> now,
> mul = 1;
> for (i = n-2; i >=0; i--){
>    mul = mul*A[i];
>    B[i] = B[i]*mul;
>
> }
>
>
> On Fri, Sep 30, 2011 at 2:18 AM, Hatta <[email protected]> wrote:
>
>> are the algorithm instance always a sequence incremented by one?
>>
>>
>>
>> On Thu, Sep 29, 2011 at 8:26 AM, raju <[email protected]> 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 [email protected].
>> > To unsubscribe from this group, send email to
>> > [email protected].
>> > For more options, visit this group at
>> > http://groups.google.com/group/algogeeks?hl=en.
>> >
>>
>>
>>
>> --
>> Hatta
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to