An Encoded Tree Traversal
research.swtch.com
research.swtch.com
not a tree guru.. but isn't this somewhat related to 'fractal tree indexing':
https://en.wikipedia.org/wiki/Fractal_tree_index
Each internal node of a B-tree will contain a number of keys that is
one less than its branching factor. The keys act as separation values
which divide its subtrees. Keys in subtrees are stored in search tree order,
that is, all keys in a subtree are between the two bracketing values.
In this regard, they are just like B-trees.
also, thanks for the plan9 stuff :DThis also generalizes to k-trees. Start at node k-1. your children are ((i - k + 2) * k) through ((i - k + 2) * k) + (k - 1), and your parent is ((i / k) - 2 + k) with integer division. Once again this all fits nicely into a flat backing array and requires no extra memory to store children or parents.
But it's not made up: this comes up in a real system and I would like to know more about the answer.