Exemple #1
0
        public void Sort(ref int[] array)
        {
            _positionalNumber = SetNumberLength(array);

            for (int i = 1; i <= _positionalNumber; i++)
            {
                Buckets tmpBuckets = new Buckets();

                for (int j = 0; j < array.Length; j++)
                {
                    string tmpToString = array[j].ToString();

                    if (tmpToString.Length < i)
                    {
                        tmpBuckets.InputBucket(0, array[j]);
                    }
                    else
                    {
                        tmpBuckets.InputBucket(int.Parse(tmpToString[tmpToString.Length - i].ToString()), array[j]);
                    }
                }

                array = tmpBuckets.GetArray();
            }
        }