Ejemplo n.º 1
0
        public static void GenerateAndFindBest(List <Task> tasks, ref List <int> bestCombOrder, ref double bestF, List <int> numbers)
        {
            formPermut fp = new formPermut();

            int[] arr1 = numbers.ToArray();
            fp.calcPermut(tasks, ref bestCombOrder, ref bestF, arr1, 0, numbers.Count - 1);
        }
Ejemplo n.º 2
0
        public static List <List <int> > Generate(List <int> numbers)
        {
            formPermut test = new formPermut();

            int[] arr1 = numbers.ToArray();
            List <List <int> > combList = new List <List <int> >();

            test.calcPermut(ref combList, arr1, 0, numbers.Count - 1);
            return(combList);
        }
    public static void Main()
    {
        formPermut test = new formPermut();

        test.prnPermutWithSubsets(new object[] { 1, 2 });
        Console.WriteLine();
        test.prnPermutWithSubsets(new object[] { 1, 2, 3 });
        Console.WriteLine();
        test.prnPermutWithSubsets(new string[] { "one", "two", "three" });
        Console.WriteLine();
        return;
    }
    public static void Main()
    {
        int        n, i;
        formPermut test = new formPermut();

        int[] arr1 = new int[6];


        Console.Write("Input the number of elements to store in the array [maximum 6 digits ] :");
        n = Convert.ToInt32(Console.ReadLine());

        for (i = 0; i < n; i++)
        {
            Console.Write(" element - {0} : ", i);
            arr1[i] = Convert.ToInt32(Console.ReadLine());
        }
        int j;

        test.seq(arr1, 0, n - 1);

        Console.ReadLine();
    }
Ejemplo n.º 5
0
    public static void Main()
    {
        int        n, i;
        formPermut test = new formPermut();

        int[] arr1 = new int[5];

        Console.WriteLine("\n\n Recursion : Generate all possible permutations of an array :");
        Console.WriteLine("------------------------------------------------------------------");

        Console.Write(" Input the number of elements to store in the array [maximum 5 digits ] :");
        n = Convert.ToInt32(Console.ReadLine());
        Console.Write(" Input {0} number of elements in the array :\n", n);
        for (i = 0; i < n; i++)
        {
            Console.Write(" element - {0} : ", i);
            arr1[i] = Convert.ToInt32(Console.ReadLine());
        }

        Console.Write("\n The Permutations with a combination of {0} digits are : \n", n);
        test.prnPermut(arr1, 0, n - 1);
        Console.Write("\n\n");
    }
        // From https://stackoverflow.com/questions/7802822/all-possible-combinations-of-a-list-of-values
        private List <String> computePotentialKeys(List <String> pks)
        {
            formPermut test = new formPermut();

            return(test.prnPermut(pks.ToArray(), 0, pks.Count() - 1));
        }