public string ApplySorting(FormsMVCModel model) { _sorterContext = SorterContextProvider(model.SortType); var output = _sorterContext.Sort(model.Input); return(output); }
public async Task <string> ApplySortingAsync(FormsMVCModel model) { _sorterContext = SorterContextProvider(model.SortType); var output = await _sorterContext.SortAsync(model.Input); return(output); }
static void Main() { var array = GenerateArray(10); Console.WriteLine("1. Buble sort"); Console.WriteLine("2. Insertion sort"); Console.WriteLine("3. Selection sort"); Console.WriteLine("4. Quick sort"); Console.WriteLine("5. Merge sort"); Console.Write("> "); var input = int.Parse(Console.ReadLine()); var context = new SorterContext(input); Console.Clear(); context.SorterAlgorithm.Sort(array); Console.ReadLine(); }
public SortingService() { _sorterContext = null; }