@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 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
@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
anot
This can be done using binary indexed tree.
Thanks and Regards,
Vishnu Vardan Reddy Onteddu
Software Engineer
KeyPoint Technologies India Pvt Ltd.
9Q1A, 9th Floor, Cyber Towers,
HITEC City, Madhapur,
Hyderabad – 500081.
T: +91 40 40337000 Extn 70__
F: +91 40 40337070
www.keypoint-tech.com
Be
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