Tries Properties
Trie Symbol Table
-
Proposition F. Properties of tries
- The linked structure(shape) of a trie is in dependent of the key insertion/deletion order: there is a unique trie for any giver set of keys. Proposition G. Worst-case time bound for search and insert
- The number of array accesses when searching in a trie or inserting a key into a trie is at most 1 plus the length of the key. Proposition H. Expected time bound for search miss
- The average number of nodes examine for search miss in a trie build from N random keys over an alphabet of size R is ~ logRN . Prosition I. Space
- The number of links in a trie is between RN and RNw , where w is the average key length.
Conclusion:
Do not try to use TrieST for large numbers of long keys taken from large alphabets. Otherwise, if you can afford the space, trie performance is difficult to beat.
Ternary search tries(TSTs)
Most important difference between R-way trie is that the BST representations of each trie node depend on the order of key insertion, as with any other BST.
- Proposition J. Space
- The number of links in a TST built from N string keys of average length w is between 3N and 3Nw.
- Proposition K. Search cost
- A search miss in a TST built from N random string keys requires ~
lnN character compares, on the average. A search hit or an insertion in a TST uses a character compare for each character in the search key.
Proposition L. One-way branching
- A search or an insertion in a TST built from N random string key with no external one-way branching and Rt−way branching at the root requires roughly lnN−tlnR character compares, on the average.