Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Radix tree
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Comparison to other data structures == (In the following comparisons, it is assumed that the keys are of length ''k'' and the data structure contains ''n'' members.) Unlike [[balanced trees]], radix trees permit lookup, insertion, and deletion in O(''k'') time rather than O(log ''n''). This does not seem like an advantage, since normally ''k'' β₯ log ''n'', but in a balanced tree every comparison is a string comparison requiring O(''k'') worst-case time, many of which are slow in practice due to long common prefixes (in the case where comparisons begin at the start of the string). In a trie, all comparisons require constant time, but it takes ''m'' comparisons to look up a string of length ''m''. Radix trees can perform these operations with fewer comparisons, and require many fewer nodes. Radix trees also share the disadvantages of tries, however: as they can only be applied to strings of elements or elements with an efficiently reversible mapping to strings, they lack the full generality of balanced search trees, which apply to any data type with a [[total ordering]]. A reversible mapping to strings can be used to produce the required total ordering for balanced search trees, but not the other way around. This can also be problematic if a data type only [[Interface (computer science)|provides]] a comparison operation, but not a (de)[[serialization]] operation. [[Hash table]]s are commonly said to have expected O(1) insertion and deletion times, but this is only true when considering computation of the hash of the key to be a constant-time operation. When hashing the key is taken into account, hash tables have expected O(''k'') insertion and deletion times, but may take longer in the worst case depending on how collisions are handled. Radix trees have worst-case O(''k'') insertion and deletion. The successor/predecessor operations of radix trees are also not implemented by hash tables.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)