Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
jhgg
· 6y ago · 0 comments
We needed to support arbitrary index access into the sorted set - which is why stdlib btree map doesn't work.
Comments
[–]
c0deb0t
6y ago
For binary trees, indexing can be done by saving the subtree size of each node and doing a sort of binary search. Not sure if this is fast for B-trees that have more than 2 children nodes, though.
[–]
Lichtso
6y ago
Do you mean OSTs?
https://en.wikipedia.org/wiki/Order_statistic_tree
[–]
ntonozzi
6y ago
Oh, that makes sense. I like the solution you arrived at!