Пример #1
0
        static void Main(string[] args)
        {
            OperationsTimer.DisplayTimerProperties();

            string s1 = "abcdefghijklmnopqrstuvwxyz";
            string s2 = "abcdefghijklmnapqrstuvwxyz";

            Stopwatch timer = Stopwatch.StartNew();

            if (perse.isDuplicated(s1))
            {
                Console.WriteLine("it has duplicated characters.");
            }
            else
            {
                Console.WriteLine("They are all unique characters.");
            }

            if (perse.isDuplicated(s2))
            {
                Console.WriteLine("it has duplicated characters.");
            }
            else
            {
                Console.WriteLine("They are all unique characters.");
            }

            timer.Stop();

            Console.WriteLine(timer.ElapsedTicks);

            timer = Stopwatch.StartNew();

            if (BruteForce.isDuplicated(s1))
            {
                Console.WriteLine("it has duplicated characters.");
            }
            else
            {
                Console.WriteLine("They are all unique characters.");
            }

            if (BruteForce.isDuplicated(s2))
            {
                Console.WriteLine("it has duplicated characters.");
            }
            else
            {
                Console.WriteLine("They are all unique characters.");
            }

            timer.Stop();
            Console.WriteLine(timer.ElapsedTicks);
        }