private static TrieNode CreateTree(string[] words, CreationOptions options)
        {
            var rootNode = TrieNode.CreateRoot(new Selection <int>(Enumerable.Range(0, words.Length), words.Length));

            var listsPool = MatcherUtil.CreateListArrayPool(words.GetCharactersDistribution());

            AddSubNodes(words, rootNode, options, listsPool);

            listsPool.Clear();

            return(rootNode);
        }
        private static TrieNode[] CreatePositionalTrees(string[] words, CreationOptions options, bool leftToRight)
        {
            var maxWordLength = words.Select(w => w.Length).Max();

            var listsPool = MatcherUtil.CreateListArrayPool(words.GetCharactersDistribution());

            var selection = new Selection <int>(Enumerable.Range(0, words.Length), words.Length);
            var rootNodes = new TrieNode[maxWordLength].SetParallel(i =>
            {
                // create root
                var r = TrieNode.CreateRoot(selection);

                // add sub nodes
                AddSubNodes(words, r, i, options, leftToRight, listsPool);

                return(r);
            });

            listsPool.Clear();

            return(rootNodes);
        }