Templates - trie

Trie Trie, pointer version of realization. If need to change the dynamic is very simple, as long as the NewNode change what you can.

```cpp
TrieNode cur = root;
for(char
i = s; i != '\0'; ++i) {
int c =
i - '0';
if(!cur->ch[c])
cur->ch[c] = NewNode();
cur = cur->ch[c];
}

Guess you like

Origin www.cnblogs.com/Yinku/p/11247784.html