Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var list = CreateLongList();

            SortingStrategy sortedStrategy = new SortingStrategy();

            sortedStrategy.SortingAlgorithm = new SelectionSort();
            sortedStrategy.List             = new List <int>(list);
            sortedStrategy.Sort();

            sortedStrategy.SortingAlgorithm = new QuickSort();
            sortedStrategy.List             = new List <int>(list);
            sortedStrategy.Sort();
        }
Exemplo n.º 2
0
            public void Sort()
            {
                _sortingStrategy.Sort(_list);

                foreach (var item in _list)
                {
                    Console.Write(item + " ");
                }
            }