Iterative Method
With the theory described so far, we can construct alternative methods to find the sequence of a number.
Path Extension in RIPTree
We have shown that numbers at the same path have a common prefix, but the length of this was at most the length of path. We have also mentioned that appending 1s to some path does not change the result of . Increasing the length of path means that we can analyze our number within a larger PIPTree, which may allow us to find a prefix so large that it is actually the sequence itself.
Traversing the PIPTree
It is simple to find the prefix of a number using PIPTree. To be more specific, we are finding the prefix of a number for some path such that . As mentioned before, a larger allows us to find the sequence faster.
For a given path and some number , we do as follows:
Construct a PIPTree for . We start at the root node with prefix and number
We need to find the directions from the node that has to the root. This can be done easily, described in a later subsection
Find the next node with respect to the directions
Calculate the nature of current node, and update the prefix with respect to the nature to move on to the next node
Repeat these steps until you reach the node with
Denote the final computed prefix as . Consider the bijective map of as , if then stop. Otherwise, repeat the entire process for number . While repeating, the computed prefix should be noted down.
TODO: Give a better pseudo-algorithm
Last updated