public TrieNode(char character, TrieNode parent_node) { this.character = character; this.parent_node = parent_node; this.word_count = 0; this.edges = new Dictionary<char,TrieNode>(); }
public TrieNode add(char character) { TrieNode edge; if (edges.ContainsKey(character)) { edge = edges[character]; } else { TrieNode new_edge = new TrieNode(character, this); edges.Add(character, new_edge); edge = new_edge; } return edge; }
public Trie() { this.root_node = new TrieNode(' ', null); }