a hybrid trie/binary tree

字典树(Trie树)

  Trie是个简单但实用的数据结构,通常用于实现字典查询。我们做即时响应用户输 入的AJAX搜索框时,就是Trie开始。本质上,Trie是一颗存储多个字符串的树。相邻节点间的边代表一个字符,这样树的每条分支代表一则子串,而树 的叶节点则代表完整的字符串。和普通树不同的地方是,相同的字符串前缀共享同一条分支。还是例子最清楚。给出一组单词,inn, int, at, age, adv, ant, 我们可以得到下面的Trie:

 

 a hybrid trie/binary tree

  Properties are stored in a hybrid trie/binary tree structure.
  Each property's name is delimited at '.' characters, and the tokens are put
  into a trie structure.  Siblings at each level of the trie are stored in a
  binary tree.  For instance, "ro.secure"="1" could be stored as follows:
 

 

 

 a hybrid trie/binary tree structure, 字典二叉查找树。一般来说不是平衡二叉树,插入时使用strcmp()函数比较小于放左子树,大于放右子树,等于则放children子树。

posted @ 2015-12-13 12:42  牧 天  阅读(500)  评论(0)    收藏  举报