public void Remove(int number) { if (listOfNumbers.Count > 4) { sortStrategy = new MergeSort(); } else { sortStrategy = new QuickSort(); } doStats(); }
public void Add(int number) { listOfNumbers.Add(number); if (listOfNumbers.Count > 10) { sortStrategy = new MergeSort(); } else { sortStrategy = new QuickSort(); } doStats(); }
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); }