Пример #1
0
        private string Solve(string text1, string text2)
        {
            SuffixTree suffixTree = new SuffixTree(text1 + "#", text2 + "$", text2.Length + 1);
            string     result     = suffixTree.BFs();

            return(result);
        }
Пример #2
0
        public string[] Solve(string text)
        {
            SuffixTree suffix = new SuffixTree(text);

            suffix.DFS();
            return(suffix.results);
        }
        public string[] Solve(string text)
        {
            var result      = new List <string>();
            var SA          = new SuffixArray();
            var suffixArray = SA.BuildSuffixArray(text);
            var lcpArray    = SA.ComputeLCPArray(text, suffixArray);
            var ST          = new SuffixTree();
            var suffixTree  = ST.BuildSuffixTree(text, suffixArray, lcpArray);
            var treeNode    = suffixTree.Children;

            TraverseTree(text, treeNode, ref result);

            return(result.ToArray());
        }