Trie树
MicZ
这个作者很懒,什么都没留下…
展开
-
HOJ 1898 Babelfish(Trie树)
题意就是先输入一个字典: 目标字符串-----输入字符串 然后输入一个字符串,在上面的对应关系中进行查找,如果有则输出目标字符串,没有则输出eh。 如果不想超时的话,明显就要套字典树了。 代码贴上来,留作模板。字典树还是挺简单易懂的嘛。。。 #include #include #include #include using namespace std; const原创 2012-08-27 22:26:25 · 415 阅读 · 0 评论 -
KeyWords Search(AC automation)
#include #include using namespace std; const int num_char=26; struct TrieNode { TrieNode *branch[num_char]; TrieNode *fail; int count;//if this is the last node of the word TrieNod原创 2012-10-24 18:44:29 · 368 阅读 · 0 评论