Beispiel #1
0
        public void Test()
        {
            var result = new Q03().EpiGeneratePermutations(new int[] { 1, 2, 3 });

            Assert.Equal(6, result.Count);
            Assert.True(result.ContainsEquivalent(new int[] { 1, 2, 3 }));
            Assert.True(result.ContainsEquivalent(new int[] { 1, 3, 2 }));
            Assert.True(result.ContainsEquivalent(new int[] { 2, 1, 3 }));
            Assert.True(result.ContainsEquivalent(new int[] { 2, 3, 1 }));
            Assert.True(result.ContainsEquivalent(new int[] { 3, 1, 2 }));
            Assert.True(result.ContainsEquivalent(new int[] { 3, 2, 1 }));
        }
Beispiel #2
0
        public void Example()
        {
            var result = new Q03().EpiGeneratePermutations(new int[] { 2, 3, 5, 7 });

            Assert.Equal(24, result.Count);

            HashSet <int[]> h = new HashSet <int[]>();

            foreach (int[] a in result)
            {
                h.Add(a);
            }
            Assert.Equal(24, h.Count);
        }