Hacker News new | ask | show | jobs
by tehbeard 975 days ago
How would the example of a scoreboard work with tiered memory?

Surely you need the sorted set in memory to derive rank/manipulate it etc?

Or would you have to shard it and add other elements on top in app code to focus on only a subsection of the data?

1 comments

> Surely you need the sorted set in memory to derive rank/manipulate it etc?

If you store it as an augmented balanced tree, then you only need to load the path from root to leaf to get or change rank. For example, if each node stored the number of leafs of its subtree, then you can avoid visiting most branches by simple logic: if you want to find element with rank=14, and left subtree only has 10 elements in total, ignore it and go straight to the right subtree, searching for element with rank=4 there.