Пример #1
0
        private ISort GetSort(eArraySortAlgorithms sortAlgorithm)
        {
            switch (sortAlgorithm)
            {
            case eArraySortAlgorithms.Insertion:
                return(new InsertionSort());

            case eArraySortAlgorithms.Selection:
                return(new SelectionSort());

            case eArraySortAlgorithms.Bubble:
                return(new BubbleSort());

            case eArraySortAlgorithms.Heap:
                return(new HeapSort());

            case eArraySortAlgorithms.Merge:
                return(new MergeSort());

            case eArraySortAlgorithms.Quick:
                return(new QuickSort());
            }

            throw new NotImplementedException("Unknown algorithm '" + nameof(sortAlgorithm) + "'");
        }
Пример #2
0
        public SortResults Estimate(eArraySortAlgorithms sortAlgorithm, eArrayDataProviders searchDataProvider)
        {
            var _sort       = GetSort(sortAlgorithm);
            var _searchData = new DataProvidersFactory(SampleSize).GetProvider(searchDataProvider);

            return(_sort.Sort(_searchData.Data));
        }