Beispiel #1
0
        public CreateListOfSortings(bool[] sorts, int[] notSortedArray)
        {
            Sorts = new ISorting[sorts.Length];
            for (int i = 0; i < sorts.Length; i++)
            {
                if (sorts[i])
                {
                    switch (i)
                    {
                    case 0: Sorts[i] = new BubbleSort(notSortedArray); break;

                    case 1: Sorts[i] = new ShakerSort(notSortedArray); break;

                    case 2: Sorts[i] = new CombSort(notSortedArray); break;
                    }
                }
            }
        }
Beispiel #2
0
        public CreateListOfSortings(bool[] sorts)
        {
            Sorts = new ISorting[sorts.Length];
            for (int i = 0; i < sorts.Length; i++)
            {
                if (sorts[i])
                {
                    switch (i)
                    {
                    case 0: Sorts[i] = new BubbleSort(); break;

                    case 1: Sorts[i] = new ShakerSort(); break;

                    case 2: Sorts[i] = new CombSort(); break;
                    }
                }
                else
                {
                    Sorts[i] = null;
                }
            }
        }