Have seen height balanced trees
Now, there are special data structures for storing words
where operations are O(|word|)-time,
i.e. The search time depends on the length of the search-word not on the number of words in the structure.
------->[a|,b , ...,z ,/]
|
|
|
v
[a ,...,n|,...z ,/]
|
|
|
v
[a ,...,z ,*]
---->[a|,b , ...,z ,/]
|
|
v
[a ,...,n|,...z ,/]
|
|
v
[a ,...,t|...,z ,*]
|
|
v
[a ,...z ,*]
eventually . . .
| © L . A l l i s o n |
--->[/,a|, ]
|
|
v
[/,l|,-]------>[n|, ]
| |
| |
| v
v [*,t|, ]
[l|, ] |
| |
| v
v [*, ]
[*, ]
PATRICIA cures the Trie's space problem:
Empty PATRICIA, insert ababb.
----->ababb
------->[5]
. .
. .
a. .b
. .
. .
ababa ababb
what about short strings?
------------------>[1]
. .
a. .b
. .
[5] ba
. .
. .
. .
ababa ababb
another short string?
------------------>[1]
. .
a. .b
. .
[2] ba
. .
a. .b
. .
aab [5]
. .
. .
. .
ababa ababb
------------------>[1]
. .
a. .b
. .
[2] ba
. .
a. .b
. .
aab [4]--->aba
.
.b
.
[5]
. .
. .
ababa ababb
------------------>[1]
. .
a. .b
. .
[2] ba
. .
a. .b
. .
aab [4]-->aba
. .
a. .b
. .
abaaab [5]
. .
. .
ababa ababb