Ejemplo n.º 1
0
        public void Teste3AlgoritmoGuloso()
        {
            //output 3
            var happyPmp = new HappyPmp("1 5 2 3 4", "1 2 3 4 5");
            var teste    = happyPmp.ObterMimPermutation();

            Assert.Equals(3, teste);
        }
Ejemplo n.º 2
0
        public void Teste4AlgoritmoGuloso()
        {
            //output 3
            var happyPmp = new HappyPmp("2 1 10 3 7 8 5 6 9 4", "6 9 2 4 1 10 3 7 8 5");
            var teste    = happyPmp.ObterMimPermutation();

            Assert.Equals(3, teste);
        }
Ejemplo n.º 3
0
        public void Teste1AlgoritmoGuloso()
        {
            //output 2
            var happyPmp = new HappyPmp("3 2 1", "1 2 3");
            var teste    = happyPmp.ObterMimPermutation();

            Assert.Equals(2, teste);
        }
Ejemplo n.º 4
0
        private static void ImprimirHappyPmp(HappyPmp happyPmp)
        {
            Console.Write("Entrada: ");
            foreach (var permutation in HappyPmp.Permutations)
            {
                Console.Write(permutation.Valor + " ");
            }
            Console.Write("\nSaida:   ");
            var nPermutation = happyPmp.ObterMimPermutation();

            foreach (var permutation in HappyPmp.Permutations)
            {
                Console.Write(permutation.Valor + " ");
            }
            Console.WriteLine("\nPermutations: " + nPermutation);
            Console.WriteLine(" ");
        }