Hmm...
A Fenwick Binary Indexed Tree allows you to calculate
the sum of elements in an array for any given index
range in O(Log(N)) time
I can modify a B-tree so each branch node keeps track of the sum total of values of nodes under it and the absolute number of nodes under it. It's pretty easy to find the sum of elements within a range, the range of elements that equal a given sum and so-forth. All O(log(n)).Why the weirdo data structure?