The OpenD Programming Language

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 (
    T.sizeof <= size_t.sizeof
    )
  2. IndexedRoR!(Permutations!T, Range) permutations(Range r)

Parameters

n size_t

number of elements (|r|)

Return Value

Type: Permutations!T

Forward range, which yields the permutations

See Also

Meta