public void AddWord(String s)
        {
            // One char string passed
            if (s.Length == 1)
            {
                endpoint = true;
                rank = 1;
                return;
            }

            // Empty child list
            if (!HasChildren())
            {
                children = new List<TrieNode>();
            }

            TrieNode temp = null;

            // Find correct child
            for (int i = 0; i < children.Count; i++)
            {
                if (children[i].c == s[1])
                {
                    temp = children[i];
                }
            }

            // Can't find the child
            if (temp == null)
            {
                temp = new TrieNode(s[1], this);
                children.Add(temp);
            }

            // Recurse
            temp.AddWord(s.Substring(1));
            rank++;
        }
 public TrieNode(char c, TrieNode parent)
 {
     this.c = c;
     this.parent = parent;
 }
 public Trie()
 {
     root = new TrieNode('*', null);
 }