@yogesh, yes you are right. It is not an array, but an abstraact data type
which supports, insertion with index.


On Tue, Sep 20, 2011 at 5:18 PM, Yogesh Yadav <medu...@gmail.com> wrote:

> @saurabh:
>
> i think may be u left some part of question to mention...  the array may be
> a heap array ...
>
> or if the ques is correct then i don't think this sum can be possible in
> O(log n)  for previously existing array...
>
> may be we have to make array from start...then as you mention we can use
> another array s[] as
>
> s[i]=s[i-1]+a[i];
>
> for each addition in a[i] we will add s[i] as above then it can be possible
> in O(1)...
>
> If i am wrong and it can be possible in O(log n) then plz tell....
>
> ....
>
> On Tue, Sep 20, 2011 at 3:28 PM, saurabh agrawal <saurabh...@gmail.com>wrote:
>
>> Design an algorithm to perform operation on an array
>> Add(i,y)-> add value y to i position
>> sum(i) -> sum of first i numbers
>> we can use additional array O(n) and worst case performance should be
>> O(log n) for both operation
>>
>> --
>> 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.
>

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