What you are describing is not really a base tree ... in a radix tree, you can have more than one character in a node, and there is no upper bound on the number of child nodes.
What you describe is more limited by the alphabet ... each node can be az, and it can be followed by another letter az, etc. The difference is critical to the data structure that you prefer to hold next-node.
In the tree you are describing, the simplest structure can be a simple array of pointers ... all you need to do is convert the character (for example, βAβ) to its ascii value ('65') and subtract the initial offset (65) to determine which "next node" you want. Takes up more space, but very quick insertion and crawl.
In a true radix tree, you can have child nodes 3, 4, 78, or 0, and your "next node" will have the overhead of sorting, inserting, and deleting. Much slower.
I cannot speak with Java, but if I implemented my own base tree in C #, I would use one of the built-in .NET collections. Writing your own sorted list doesn't really help you learn tree concepts, and the built-in optimization of .NET collections is very complicated. Then your code is simple: look at your next node; if there is, grab it and leave; if not, add it to the next node collection.
Which collection you use depends on what you are implementing through the tree ... each type of tree includes trade-offs between insertion time, search time, etc. The choices you make depend on what is most important for the application, not the tree.
Make sense?
source share