Exemplo n.º 1
0
 public void FindLargestAndSwap()
 {
     var p = new Permutations();
     var elements = GetElements();
     p.FirstStepSwapAdj(elements);
     Assert.AreEqual(3, elements[1].Value);
     Assert.AreEqual(2, elements[2].Value);
 }
Exemplo n.º 2
0
 public void TestRun_3Elements()
 {
     var p = new Permutations();
     var elements = GetElements();
     var result = p.CreatePermutationsWithoutRepetition(elements.ToList());
     CollectionAssert.AreEqual(new int[] { 1, 2, 3 }, result[0].GetValues());
     CollectionAssert.AreEqual(new int[] { 1, 3, 2 }, result[1].GetValues());
     CollectionAssert.AreEqual(new int[] { 3, 1, 2 }, result[2].GetValues());
     CollectionAssert.AreEqual(new int[] { 3, 2, 1 }, result[3].GetValues());
     CollectionAssert.AreEqual(new int[] { 2, 3, 1 }, result[4].GetValues());
     CollectionAssert.AreEqual(new int[] { 2, 1, 3 }, result[5].GetValues());
 }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            var p = new Permutations();
            var elements = GetElements();
            var result = p.CreatePermutationsWithoutRepetition(elements.ToList());
            List<string> values = new List<string>();
            foreach (var r in result)
            {
                values.Add(r.ToStringRepresenation());
            }
            values.Sort();
            Console.WriteLine(values[999999]);

            Console.ReadLine();
        }
Exemplo n.º 4
0
 public void FindLargestMobileElement3()
 {
     var p = new Permutations();
     var largest = p.GetLargestMobile(GetElements3());
     Assert.AreEqual(3, largest.Value);
 }