While it is hard to find an unanimous definition of "Radix Tree", most accepted definitions of Radix Tree indicate that it is a compacted Prefix Tree. What I'm struggling to understand is the significance of the term "radix" in this case. Why compacted prefix trees are so named (i.e. Radix Tree) and non-compacted ones are not called Radix Tree?
相关问题
- Highlight parent path to the root
- Avoid overlapping of nodes in tree layout in d3.js
- Get path of node in tree
- C++ a class with an array of structs, without know
- Character.getNumericvalue in char Frequency table
相关文章
- Is there an existing solution for these particular
- Systematically applying a function to all fields o
- Why can we add null elements to a java LinkedList?
- Is Heap considered an Abstract Data Type?
- Scala variadic functions and Seq
- Word frequency in a large text file
- Problems with Promote() using the red-black tree i
- Access nested children in xml file parsed with Ele
Wikipedia can answer this, https://en.wikipedia.org/wiki/Radix:
and the tree https://en.wikipedia.org/wiki/Radix_tree:
Finally check a dictionary:
The radix in the radix tree determines the balance between the amount of children (or depth) of the tree and the 'sparseness', or how many suffixes are unique.
EDIT - elaboration
Let's consider the words "aba,abnormal,acne, and abysmal". In a regular prefix tree (or trie), every arc adds a single letter to the word, so we have:
My drawing is a bit misleading - in tries the letters usually sit on arcs, so '-' is a node and the letters are edges. Note many internal nodes have one child! Now the compact (and obvious) form:
Well now we have an inner node (behind b) with 3 children! The radix is a positive power of 2, so 2 in this case. Why 2 and not say 3? Well first note the root has 2 children. In addition, suppose we want to add a word. Options:
b
prefix - well, 4 is greater than 2.b
- say 'abnormally'. Well The way insertion works the shared part will split and we'll have:Relevant branch:
normal is an inner node now, but has 2 children (one a leaf). - another case would be deleting acne for example. But now the compactness property says The node after
b
must be merged back, since it's the only child, so the tree becomestree:
so, we still maintain children>2.
Hope this clarifies!