Пример #1
0
        private void Task1()
        {
            Console.WriteLine("Insert number of elements");
            int n = InputParameter();

            Console.WriteLine("Insert maximum value of elements");
            int max = InputParameter();

            Element[] elements = GenerateElements(n, max);

            SortingAlgorithm s = InputAlgorithm();

            if (s.IsInPlace())
            {
                Visualization g = new Visualization(elements);
                g.StartWithNewThread();
            }
            s.Sort(elements);
            Console.WriteLine(s.GetName() + " has finished");
            if (s.Stable)
            {
                Console.WriteLine(s.GetName() + " is stable");
            }
            else
            {
                Console.WriteLine(s.GetName() + " is not stable");
            }
            Console.WriteLine("Time: " + s.GetElapsedTime());
        }
Пример #2
0
        private void Task1()
        {
            Console.WriteLine("Insert number of elements");
            int n = InputParameter();

            Console.WriteLine("Insert maximum value of elements");
            int max = InputParameter();

            Element[] elements = GenerateElements(n, max);

            SortingAlgorithm s = InputAlgorithm();
            Visualization    g = new Visualization(elements);

            g.StartWithNewThread();
            s.Sort(elements);
            Console.WriteLine("Time: " + s.GetElapsedTime());
        }