ParentFull threadFelz·Yea, I think you basically do need one of these: https://en.wikipedia.org/wiki/Order_statistic_treeThey're somewhat obscure though.View on HN