public void Main() { long[] A = new long[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; List <long> permutations = new List <long>(); MergingTime.CreatePermutations(permutations, A, 0, A.Length - 1); permutations.Sort(); Trace.WriteLine("Count: " + permutations.Count + " " + permutations[999999]); }
public void TestTwo() { string[] A = new string[] { "t", "o", "m", "e" }; List <List <string> > permutations = new List <List <string> >(); MergingTime.CreatePermutationsString(permutations, A, 0, A.Length - 1); Assert.AreEqual(24, permutations.Count); string[] B = new string[] { "t", "o", "m" }; permutations.Clear(); MergingTime.CreatePermutationsString(permutations, B, 0, B.Length - 1); Assert.AreEqual(6, permutations.Count); string[] C = new string[] { "t", "o", "m", "e", "a" }; permutations.Clear(); MergingTime.CreatePermutationsString(permutations, C, 0, C.Length - 1); Assert.AreEqual(120, permutations.Count); string[] D = new string[] { "t", "o", "m", "e", "a", "i" }; permutations.Clear(); MergingTime.CreatePermutationsString(permutations, D, 0, D.Length - 1); Assert.AreEqual(720, permutations.Count); }