示例#1
0
        public static void TestPermutationsGenerationOnTwelveElementsIntSet()
        {
            var color = Console.ForegroundColor;
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("Testing int permutations generation on twelve element int set");
            Console.ForegroundColor = color;

            var input = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
            var permutationsGenerator = new PermutationGenerator();
            var stopwatch = Stopwatch.StartNew();

            int counter = 1;
            while (permutationsGenerator.Next<int>(input))
            {
                counter++;
            }

            stopwatch.Stop();

            Console.WriteLine("Generated {0} permutations in {1} miliseconds.", counter, stopwatch.ElapsedMilliseconds);
            Console.WriteLine("CountAll returned {0}.", permutationsGenerator.CountAll(input));
            Console.WriteLine();
        }