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?

Était-ce utile?

La 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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top