private void Delete(Node root, string word, int index) { if (index == word.Length) { root._isEndOfWord = false; return; } var ch = word[index]; var child = root.GetChild(ch); if (child == null) { return; } Delete(child, word, index + 1); if (!child.HasChildren() && !child._isEndOfWord) { root.RemoveChild(ch); } //Console.WriteLine(ch); }