A common trick in data structures design for trees is to annotate nodes with information about the subtree. For example, if you want to efficiently query the sum of a range in a tree, if sums are stored in subtrees you only need to query logarithmically many.

Now here's a question: why do we not have any extensible, modular way of adding this metadata to vanilla data structures? Why do I have to reimplement red-black trees plus bonus features if I want to do this?
Shared publiclyView activity