public final class Combinatorics extends Object
| Modifier and Type | Method and Description |
|---|---|
static CombinatorialIterator<int[]> |
combinations(int n,
int k)
Iterator over all k-combinations from {code n}.
|
static <T> CombinatorialIterator<T[]> |
combinations(T[] input,
int k)
Iterator over all k-combinations from the specified array
|
static CombinatorialIterator<int[]> |
combinationsWithPermutations(int n,
int k)
Iterator over all k-combinations with permutations from {code n}.
|
static <T> CombinatorialIterator<T[]> |
combinationsWithPermutations(T[] input,
int k)
Iterator over all k-combinations with permutations from the specified array
|
static CombinatorialIterator<int[]> |
compositions(int integer,
int nPartitions)
Iterator over all compositions of
integer into nPartitions |
static CombinatorialIterator<int[]> |
distinctTuples(int[]... sets)
Iterator over all distinct N-tuples, which can be chosen from
N specified sets of integers. |
static <T> CombinatorialIterator<T[]> |
distinctTuples(T[]... sets)
Iterator over all N-tuples of elements at different positions, which can be chosen from
N specified sets
of elements. |
static CombinatorialIterator<int[]> |
permutations(int n)
Iterator over all permutations of the specified length
|
static <T> CombinatorialIterator<T[]> |
permutations(T[] input)
Iterator over all permutations of the specified array
|
static CombinatorialIterator<int[]> |
tuples(int... bounds)
Iterator over all N-tuples (not necessary to be distinct), which can be chosen from
N arrays of integers
of the form arrayi = [0, 1, 2, ..., Ki] |
static <T> CombinatorialIterator<T[]> |
tuples(T[]... sets)
Iterator over all N-tuples, which can be chosen from
N specified sets of integers. |
public static CombinatorialIterator<int[]> combinations(int n, int k)
n - combination lengthk - the totalpublic static CombinatorialIterator<int[]> combinationsWithPermutations(int n, int k)
n - combination lengthk - the totalpublic static CombinatorialIterator<int[]> permutations(int n)
public static CombinatorialIterator<int[]> compositions(int integer, int nPartitions)
integer into nPartitionsinteger - the sumnPartitions - number of partitionsIntCompositionspublic static CombinatorialIterator<int[]> distinctTuples(int[]... sets)
N specified sets of integers.sets - array of sets of integersIntDistinctTuplespublic static CombinatorialIterator<int[]> tuples(int... bounds)
N arrays of integers
of the form arrayi = [0, 1, 2, ..., Ki]bounds - the bounds on the tuple elementsIntDistinctTuplespublic static <T> CombinatorialIterator<T[]> permutations(T[] input)
public static <T> CombinatorialIterator<T[]> combinations(T[] input, int k)
public static <T> CombinatorialIterator<T[]> combinationsWithPermutations(T[] input, int k)
public static <T> CombinatorialIterator<T[]> distinctTuples(T[]... sets)
N specified sets
of elements.sets - array of sets of integersIntDistinctTuplespublic static <T> CombinatorialIterator<T[]> tuples(T[]... sets)
N specified sets of integers.sets - array of sets of integersIntDistinctTuplesCopyright © 2017. All rights reserved.