Пример #1
0
        public void Add(SortedTrieNode node, FWord fWord, int pos)
        {
            while (true)
            {
                if (pos != 0)
                {
                    node._words.Add(fWord);
                }

                if (pos == fWord.Word.Length)
                {
                    return;
                }

                var firstChar = fWord.Word[pos];
                var index     = (int)(firstChar - 'a');
                if (node._children[index] == null)
                {
                    node._children[index] = new SortedTrieNode();
                }

                node = node._children[index];
                pos  = ++pos;
            }
        }
Пример #2
0
 /// <summary>
 /// Добавить слово Word в словарь
 /// </summary>
 public void Add(FWord word)
 {
     _node.Add(_node, word, 0);
 }