permutations

Lazily computes all permutations of r using Heap's algorithm.

While generating a new item is in O(k) (amortized O(1)), the number of permutations is |n|!.

  1. Permutations!T permutations(size_t n)
    @safe pure nothrow
    permutations
    (
    T = uint
    )
    (
    size_t n
    )
    if (
    isUnsigned!T &&
    T.sizeof <= size_t.sizeof
    )
  2. IndexedRoR!(Permutations!T, Range) permutations(Range r)
  3. Permutations!T makePermutations(Allocator alloc, size_t n)

Parameters

n size_t

number of elements (|r|)

Return Value

Type: Permutations!T

Forward range, which yields the permutations

See Also

Meta