ALGS4_5.2 Tries

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 Rtway branching at the root requires roughly lnNtlnR character compares, on the average.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值