3 ms·
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. Th
by trishume 5y 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.
- contravariant 5y agoI 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.