Hacker News new | ask | show | jobs
by trishume 1882 days ago
Standard Fenwick trees can only do prefix sums, which only get you general range queries on things with a subtraction operator, not operations like maximum.

The reddit comment I link contains an implementation that allegedly does arbitrary range queries, but it's nigh-incomprehensible so I can't tell how or why it uses 3 arrays.

1 comments

I see, yeah I can't help you there either. I don't see how a tree based approach would ever need more than twice the amount of space.