예제 #1
0
        public void Remove(int number)
        {
            if (listOfNumbers.Count > 4)
            {
                sortStrategy = new MergeSort();
            }
            else
            {
                sortStrategy = new QuickSort();
            }

            doStats();
        }
예제 #2
0
        public void Add(int number)
        {
            listOfNumbers.Add(number);

            if (listOfNumbers.Count > 10)
            {
                sortStrategy = new MergeSort();
            }
            else
            {
                sortStrategy = new QuickSort();
            }
            doStats();
        }
예제 #3
0
        private static ISortingStrategy GetSortingOption(ObjectToSort objectToSort)
        {
            ISortingStrategy sortingStrategy = null;

            switch (objectToSort)
            {
            case ObjectToSort.StudentNumber:
                sortingStrategy = new MergeSort();
                break;

            case ObjectToSort.RailwayPassengers:
                sortingStrategy = new HeapSort();
                break;

            case ObjectToSort.CountyResidents:
                sortingStrategy = new QuickSort();
                break;

            default:
                break;
            }
            return(sortingStrategy);
        }