combinat-0.1: Generation of various combinatorial objects.

Math.Combinat.Permutations

Contents

Description

Permutations. See: Donald E. Knuth: The Art of Computer Programming, vol 4, pre-fascicle 2B.

Synopsis

Permutations of distinct elements

_permutations :: Int -> [[Int]]Source

Permutations of [1..n] in lexicographic order, naive algorithm.

Permutations of a multiset

permute :: (Eq a, Ord a) => [a] -> [[a]]Source

Generates all permutations of a multiset. The order is lexicographic.

countPermute :: (Eq a, Ord a) => [a] -> IntegerSource

# = \frac { (sum_i n_i) ! } { \prod_i (n_i !) }

fasc2B_algorithm_L :: (Eq a, Ord a) => [a] -> [[a]]Source

Generates all permutations of a multiset (based on "algorithm L" in Knuth; somewhat less efficient). The order is lexicographic.