示例#1
0
        private List <int> GetIncrements(IncrementsType type)
        {
            List <int> Increments = new List <int>();
            int        last       = 1;
            int        t          = 1;

            do
            {
                Increments.Insert(0, t);
                switch (type)
                {
                case IncrementsType._3Kplus1:
                    t = 3 * t + 1;
                    break;

                case IncrementsType._2Kplus1:
                    t = 2 * t + 1;
                    break;

                case IncrementsType.Fibonachi:
                    t   += last;
                    last = t - last;
                    break;
                }
            } while (t <= arr.Length / 2);
            return(Increments);
        }
示例#2
0
 public List <State> GetSortStates(int Count, IncrementsType type)
 {
     Init(Count);
     Randomize(Count * 2);
     states = new List <State>();
     SortShell(GetIncrements(type));
     return(states);
 }