Java implementation of Tire

Java implementation of Tire

 

Trie, also known as word lookup tree or key tree, is a tree structure. The typical application is to count and sort a large number of strings (but not limited to strings), so it is often used by search engine systems for text word frequency statistics. Its advantages are: minimize unnecessary string comparisons, and query efficiency is higher than hash tables.

It has 3 basic properties:

  • The root node contains no characters, and each node except the root node contains only one character.
  • From the root node to a certain node, the characters passing on the path are connected to form the string corresponding to the node.
  • All children of each node contain different characters.

The following figure is the representation of Trie, each edge represents a character, and if it ends, it is represented by an asterisk. In this Trie structure, we have the following strings, such as do, dork, dorm, etc., but there is no ba, and no sen in the Trie, because there is no end symbol (asterisk) at the end of a, and n.

 

http://www.cnblogs.com/yydcdut/p/3846441.html

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326307479&siteId=291194637