private bool Search(string word, int index, TierNode node) { if (node == null) { return(false); } if (index == word.Length) { return(node.IsEnd); } var c = word[index]; if (c == '.') { foreach (var temp in node.Links) { if (Search(word, index + 1, temp)) { return(true); } } return(false); } else { node = node.Get(c); } return(Search(word, index + 1, node)); }
public void Put(char c) { Links[c - 'a'] = new TierNode(); }