Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            List <List <int> > result = Permutations.findPermutations(new int[] { 1, 3, 5 });

            Console.WriteLine("Here are all the permutations: " + result);
        }
Ejemplo n.º 2
0
        public void Benchmark_duplicates()
        {
            var result = Permutations.Of("aaaabbbbcccc");

            Assert.That(result.ToArray().Contains("ccccbbbbaaaa"));

            Assert.That(result.Count(), Is.EqualTo(34650)); // 12!/(4!)^3;
        }
Ejemplo n.º 3
0
        public void Benchmark()
        {
            var result = Permutations.Of("012345678");

            Assert.That(result.ToArray().Contains("876543210"));

            Assert.That(result.Count, Is.EqualTo(362_880)); // 9!
        }
Ejemplo n.º 4
0
        private static void GetPermutations()
        {
            List <int> integers = new List <int> {
                1, 2, 3
            };

            Permutations <int> p = new Permutations <int>(integers);

            foreach (IList <int> item in p)
            {
                string line = string.Join(",", item);
                Console.WriteLine(line);
            }
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            Stopwatch MyTimer = new Stopwatch();

            MyTimer.Start();
            Permutations.PrintList(Permutations.SinglePermutations("a"));
            Console.WriteLine();
            Permutations.PrintList(Permutations.SinglePermutations("ab"));
            Console.WriteLine();
            Permutations.PrintList(Permutations.SinglePermutations("abcc"));
            MyTimer.Stop();
            Console.WriteLine(MyTimer.ElapsedMilliseconds.ToString("00:00:00"));
            Console.ReadKey();
        }
Ejemplo n.º 6
0
 public void Duplicates_are_ignored()
 {
     Assert.That(Permutations.Of("aab"),
                 Is.EquivalentTo(new [] { "aab", "aba", "baa" }));
 }
Ejemplo n.º 7
0
 public void Returns_correct_permutations(string input, string[] expected)
 {
     Assert.That(Permutations.Of(input), Is.EquivalentTo(expected));
 }