Question

http://en.wikipedia.org/wiki/Radix_tree So instead of a function i used an integer value instead for isLeaf. But how many elements should an array of edges have? How many children max for each node?

Was it helpful?

Solution

That depends on your radix. The maximum number of children of a node is the number of possible unique values of the chosen discriminator; if you use a character for the discriminator, then the maximum number of children will be the number of valid characters.

You can implement this data-structure with a radix of two, by discriminating on each bit; in this case, your trees will be deeper but each non-leaf node will have exactly two children, which might simplify the implementation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top