static void Main(string[] args) { int[] arr1 = { 31, 15, 10, 2, 4, 2, 14, 23, 12, 66 }; StrategySort sort = new SelectionSort(); Context context = new Context(sort, arr1); context.Sort(); context.PrintArray(); int[] arr2 = { 1, 5, 10, 2, 4, 12, 14, 23, 12, 66 }; sort = new InsertionSort(); context = new Context(sort, arr2); context.Sort(); context.PrintArray(); int[] arr3 = { 1, 5, 10, 2, 4, 12, 14, 23, 12, 66 }; sort = new BubbleSort(); context = new Context(sort, arr3); context.Sort(); context.PrintArray(); Navigator navigator = new Navigator(); navigator.Execute(); }
static void Main() { #region Bubble Sort Console.WriteLine("Bubble Sort"); var bubbleSort = new BubbleSort(); var bubbleSortContext = new Context(bubbleSort); bubbleSortContext.Sort(); bubbleSortContext.PrintArray(); #endregion #region Insertion Sort Console.WriteLine("Insertion Sort"); var insertionSort = new InsertionSort(); var insertionSortContext = new Context(insertionSort); insertionSortContext.Sort(); insertionSortContext.PrintArray(); #endregion #region Selection Sort Console.WriteLine("Selection Sort"); var selectionSort = new SelectionSort(); var selectionSortContext = new Context(selectionSort); selectionSortContext.Sort(); selectionSortContext.PrintArray(); #endregion Console.ReadKey(); }
static void Main() { var sort = new SelectionSort(); var context = new Context(sort); context.Sort(); context.PrintArray(); }
static void Main(string[] args) { var sort = new BubbleSort(); var context = new Context(sort); context.Sort(); context.PrintArray(); }
static void Main(string[] args) { int[] arr1 = { 31, 15, 10, 2, 4, 2, 14, 23, 12, 66 }; StrategySort sort = new SelectionSort(); Context context = new Context(sort, arr1); context.Sort(); context.PrintArray(); int[] arr2 = { 1, 5, 10, 2, 4, 12, 14, 23, 12, 66 }; sort = new InsertionSort(); context = new Context(sort, arr2); context.Sort(); context.PrintArray(); }
static void Main(string[] args) { int[] arr1 = { 31, 15, 10, 2, 4, 2, 14, 23, 12, 66 }; StrategySort sort = new SelectionSort(); Context context = new Context(sort, arr1); context.Sort(); context.PrintArray(); int[] arr2 = { 1, 5, 10, 2, 4, 12, 14, 23, 12, 66 }; sort = new InsertionSort(); context = new Context(sort, arr2); context.Sort(); context.PrintArray(); int[] arr3 = { 6, 3, 8, 1, 2, 9, 4, 5, 7 }; sort = new BubbleSort(); context = new Context(sort, arr3); context.Sort(); context.PrintArray(); Console.ReadKey(); }