Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
loicfevrier
· 17y ago · 0 comments
But you will need to re-compute the sum each time you are doing an update wich takes O(n). You can use Binary Indexed Trees to do that efficiently :
http://www.topcoder.com/tc?module=Static&d1=tutorials...
Comments
[–]
bravura
17y ago
It appears that Binary Indexed Trees are appropriate only when the weights are integral?
[–]
loicfevrier
OP
17y ago
Exact, I forgot that point.