예제 #1
0
        private void QuickSortString(List <StringSup> lstStr, int begin, int end)
        {
            if (begin >= end)
            {
                return;
            }
            StringSup pivot   = lstStr[end];
            int       current = begin;

            for (int i = begin; i < end; i++)
            {
                if (lstStr[i].CompareTo(pivot) == 1)
                {
                    string temp = lstStr[i].ToString();
                    lstStr[i].Info       = lstStr[current].Info;
                    lstStr[current].Info = temp;
                    current++;
                }
            }

            string tem = lstStr[end].Info;

            lstStr[end].Info     = lstStr[current].Info;
            lstStr[current].Info = tem;

            QuickSortString(lstStr, 0, current - 1);
            QuickSortString(lstStr, current + 1, end);
        }
예제 #2
0
        public int CompareTo(object obj)
        {
            StringSup ss = (StringSup)obj;
            string    X  = this.Info + ss.Info;
            string    Y  = ss.Info + this.Info;

            int XX = Convert.ToInt32(X);
            int YY = Convert.ToInt32(Y);

            return(XX > YY ? 1 : -1);
        }