Exemple #1
0
        private string[] suffixes; //后缀数组

        #endregion Fields

        #region Constructors

        public SuffixArray(string s)
        {
            N = s.Length;
            suffixes = new string[N];
            for (int i = 0; i < N; i++) suffixes[i] = s.Substring(i);//构造后缀数组
            MSD msd = new MSD();//将后缀数组排序
            msd.sort(suffixes);
        }
Exemple #2
0
        private int N;             //字符串的长度(即后缀数组的维度)

        public SuffixArray(string s)
        {
            N        = s.Length;
            suffixes = new string[N];
            for (int i = 0; i < N; i++)
            {
                suffixes[i] = s.Substring(i); //构造后缀数组
            }
            MSD msd = new MSD();              //将后缀数组排序

            msd.sort(suffixes);
        }