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!
=== Insertion === To insert a string, we search the tree until we can make no further progress. At this point we either add a new outgoing edge labeled with all remaining elements in the input string, or if there is already an outgoing edge sharing a prefix with the remaining input string, we split it into two edges (the first labeled with the common prefix) and proceed. This splitting step ensures that no node has more children than there are possible string elements. Several cases of insertion are shown below, though more may exist. Note that r simply represents the root. It is assumed that edges can be labelled with empty strings to terminate strings where necessary and that the root has no incoming edge. (The lookup algorithm described above will not work when using empty-string edges.) <gallery widths="300" heights="200" mode="nolines"> File:Inserting the string 'water' into a Patricia trie.png|Insert 'water' at the root File:Insert 'slower' with a null node into a Patricia trie.png|Insert 'slower' while keeping 'slow' File:Insert 'test' into a Patricia trie when 'tester' exists.png|Insert 'test' which is a prefix of 'tester' File:Inserting the word 'team' into a Patricia trie with a split.png|Insert 'team' while splitting 'test' and creating a new edge label 'st' File:Insert 'toast' into a Patricia trie with a split and a move.png|Insert 'toast' while splitting 'te' and moving previous strings a level lower </gallery>
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)