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!
{{Short description|Data structure}} [[File:Patricia trie var.svg|thumb|An example of a radix tree|350x350px]] In [[computer science]], a '''radix tree''' (also '''radix trie''' or '''compact prefix tree''' or '''compressed trie''') is a [[data structure]] that represents a [[Memory Optimization|space-optimized]] [[trie]] (prefix tree) in which each node that is the only child is merged with its parent. The result is that the number of children of every internal node is at most the [[radix]] {{mvar|r}} of the radix tree, where {{mvar|r}} = 2<sup>{{mvar|x}}</sup> for some integer {{mvar|x}} ≥ 1. Unlike regular trees, edges can be labeled with sequences of elements as well as single elements. This makes radix trees much more efficient for small sets (especially if the strings are long) and for sets of strings that share long prefixes. Unlike regular trees (where whole keys are compared ''en masse'' from their beginning up to the point of inequality), the key at each node is compared chunk-of-bits by chunk-of-bits, where the quantity of bits in that chunk at that node is the radix {{mvar|r}} of the radix trie. When {{mvar|r}} is 2, the radix trie is binary (i.e., compare that node's 1-bit portion of the key), which minimizes sparseness at the expense of maximizing trie depth—i.e., maximizing up to conflation of nondiverging bit-strings in the key. When {{mvar|r}} ≥ 4 is a power of 2, then the radix trie is an {{mvar|r}}-ary trie, which lessens the depth of the radix trie at the expense of potential sparseness. As an optimization, edge labels can be stored in constant size by using two pointers to a string (for the first and last elements).<ref>{{cite web|last=Morin|first=Patrick|title=Data Structures for Strings|url=http://cg.scs.carleton.ca/~morin/teaching/5408/notes/strings.pdf|access-date=15 April 2012}}</ref> Note that although the examples in this article show strings as sequences of characters, the type of the string elements can be chosen arbitrarily; for example, as a bit or byte of the string representation when using [[multibyte character]] encodings or [[Unicode]].
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)