コード例 #1
0
        static public void WritePermutationIndexLO(int[] permutation) // LO- lexicographical order
        {
            int[][] cyclePermutation = WithoutRepetition.PermutationToCycle(permutation);
            long    index            = WithoutRepetition.PermutationIndexInLexOrder(permutation);

            using (StreamWriter writer = new StreamWriter("log.txt", true))
            {
                WriteDate(writer);
                WriteLine(writer, "Permutation index in lexicographical order: ");
                WriteLine(writer);
                Write(writer, "One-line notation: ");
                WriteVector(writer, permutation);
                WriteLine(writer);
                Write(writer, "Canonical cycle notation: ");
                WriteCycle(writer, cyclePermutation);
                WriteLine(writer);
                WriteLine(writer);
                WriteLine(writer, "Index: " + index);
                WriteLine(writer);
            }
        }