/// <summary> /// Performs the actual recursive insertion of the characters in the item into the Trie nodes /// </summary> /// <param name="node"></param> /// <param name="item"></param> /// <param name="index"></param> protected void AddRecursive(TrieNode node, String item, int index) { // If we are at and end of word - mark the node as ending a word if (item.Length == index) { node.EndsWord = true; return; } char firstChar = item[index]; TrieNode childNode = node.AddOrGetNode(firstChar); if (childNode != null) { AddRecursive(childNode, item, index + 1); } }