예제 #1
0
        public void SortDoubleData(ISorts sortingMethod, string nameOfSort)
        {
            stopWatch.ResetStopWatch();
            stopWatch.StartStopWatch();

            sortingMethod.Sort();

            stopWatch.StopStopWatch();
            stopWatch.GetTimeElapsed(nameOfSort);

            stopWatch.ResetStopWatch();
            stopWatch.StartStopWatch();

            sortingMethod.WriteSortList();

            stopWatch.StartStopWatch();
            stopWatch.GetTimeElapsed(nameOfSort + "To Write To File");
        }
예제 #2
0
        //I have two methods one for the guids and the other for Doubles
        public void SortGuidData(ISorts sortingMethod, string nameOfSort)
        {
            sortingMethod.ChangeGuidsToInt64();
            stopWatch.ResetStopWatch();
            stopWatch.StartStopWatch();

            sortingMethod.Sort();

            stopWatch.StopStopWatch();
            stopWatch.GetTimeElapsed(nameOfSort);

            stopWatch.ResetStopWatch();
            stopWatch.StartStopWatch();

            sortingMethod.WriteSortList();
            stopWatch.StartStopWatch();

            stopWatch.GetTimeElapsed(nameOfSort + " To Write To File");
        }
예제 #3
0
 public void sort()
 {
     _sortsType.Sort();
 }
예제 #4
0
        public void ChoiceSort(SortName sort)
        {
            switch (sort)
            {
            case SortName.SELECTIONSORT:
                ConsoleManager.GreenSendToConSole("Сортировка Выбором");
                SetNullForCompareAndTransposition();
                SetStart();
                SelectionSort(0, arrayLength - 1);
                SetEnd();
                SetInterval();
                break;

            case SortName.INSERTIONSORT:
                ConsoleManager.GreenSendToConSole("Сортировка Вставками");
                SetNullForCompareAndTransposition();
                SetStart();
                InsertionSort(0, arrayLength - 1);
                SetEnd();
                SetInterval();
                break;

            case SortName.BUBBLESORT:
                ConsoleManager.GreenSendToConSole("Сортировка Пузырьком");
                SetNullForCompareAndTransposition();
                SetStart();
                BubbleSort(0, arrayLength - 1);
                SetEnd();
                SetInterval();
                break;

            case SortName.SHAKERSORT:
                ConsoleManager.GreenSendToConSole("Сортировка Шейкерная");
                SetNullForCompareAndTransposition();
                SetStart();
                ShakerSort(0, arrayLength - 1);
                SetEnd();
                SetInterval();
                break;

            case SortName.SHELLSORT:
                ConsoleManager.GreenSendToConSole("Сортировка Шелла");
                SetNullForCompareAndTransposition();
                SetStart();
                ShellSort(0, arrayLength - 1);
                SetEnd();
                SetInterval();
                break;

            case SortName.MERGESORT:
                MySorts = new MergeSort(array);
                ConsoleManager.GreenSendToConSole("Сортировка Слиянием");
                SetNullForCompareAndTransposition();
                SetStart();
                MySorts.Sort(0, arrayLength - 1);
                SetEnd();
                SetInterval();
                array = MySorts.a;
                break;

            case SortName.QUICKSORT:
                MySorts = new QuickSort(array);
                ConsoleManager.GreenSendToConSole("Быстрая сортировка");
                SetNullForCompareAndTransposition();
                SetStart();
                MySorts.Sort(0, arrayLength - 1);
                SetEnd();
                SetInterval();
                array = MySorts.a;
                break;

            case SortName.HEAPSORT:
                MySorts = new HeapSorter(array);
                ConsoleManager.GreenSendToConSole("Сортировка Кучей");
                SetNullForCompareAndTransposition();
                SetStart();
                MySorts.Sort(0, arrayLength - 1);
                SetEnd();
                SetInterval();
                array = MySorts.a;
                break;

            default:
                break;
            }
        }