Thursday, August 18, 2011

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

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

Practice Problem For Binary Index Tree :

http://problemclassifier.appspot.com/index.jsp?search=BIT&usr=
http://problemclassifier.appspot.com/index.jsp?search=tree&usr=

No comments :