static void Main(string[] args) { StrategyClient c = new StrategyClient(); string arr = "12363"; c.SetStrategy(new BubbleSort()); c.ExecuteStrategy(arr); c.SetStrategy(new InsertingSort()); c.ExecuteStrategy(arr); c.SetStrategy(new SelectionSort()); c.ExecuteStrategy(arr); Console.ReadKey(); }
static void Main(string[] args) { StrategyClient client = new StrategyClient(); Random r = new Random(); int[] arr = new int[10]; arr = arr.Select(x => x = r.Next(-99, 100)).ToArray(); client.SetStrategy(new SelectionSort()); client.ExecuteStrategy(arr); arr = arr.Select(x => x = r.Next(-99, 100)).ToArray(); client.SetStrategy(new InsertingSort()); client.ExecuteStrategy(arr); arr = arr.Select(x => x = r.Next(-99, 100)).ToArray(); client.SetStrategy(new BubbleSort()); client.ExecuteStrategy(arr); }