2 ms·
You can encode and store an entire tree path/sequence in a single rational number. The encoded number is reversible -- the number is encoded in such a way that
by espeed 10y ago
You can encode and store an entire tree path/sequence in a single rational number.
The encoded number is reversible -- the number is encoded in such a way that you can algorithmically calculate/derive each node's parents and ancestors without querying the database or traversing the tree. Possible siblings and children can be calculated the same way (if they exist).
More exotic adaptations might include a form of semantic content-based addressing by mapping the code to coordinates in a metric space. For example, see the similar Calkin-Wilf H-tree layout: https://en.wikipedia.org/wiki/Calkin–Wilf_tree#Definition_and_structure https://en.wikipedia.org/wiki/Calkin–Wilf_tree#Definition_an...