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?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top