Package gmisclib :: Module permute
[frames] | no frames]

Module permute

source code

Find different permutations of an array.

Functions
 
next(a, n)
Finds the first valid permutation of n items after a.
source code
 
factorial(n) source code
 
permutations(n)
Returns an array of all the n! permutations of n objects.
source code
Variables
  __package__ = 'gmisclib'

Imports: Num


Function Details

next(a, n)

source code 

Finds the first valid permutation of n items after a. A valid permutation is an array of length n which contains values from 0 to n-1, once each. This function returns the lexicographically next permutation; it's input need not be a valid permutation, but all the entries of a should be in the range 0 to n-1, inclusive.