public class PermutationFactory
extends java.lang.Object
These types are:
example: source=[1,2,3] result=[1,2,3][1,3,2][2,1,3][2,3,1][3,1,2][3,2,1]
example: source=[1,1,2] result=[1,1,2][1,2,1][2,1,1]
example: assume source=the groups are sizes are : 1,2,2,5 elements will be created: (1),(2,3),(4,5).
result=[1,(2,3),(4,5)] [1,(2,3),(5,4)] [1,(3,2),(5,4)] [1,(3,2),(4,5)]. In this example the number of possiblities is 1! x 2! x 2! = 4
Constructor and Description |
---|
PermutationFactory() |
Modifier and Type | Method and Description |
---|---|
static ArrayPermutationsIter |
createByGroups(int[] groupSizesArray)
For efficiency, try putting the biggest groups at the beggining of the
array.
|
static ArrayPermutationsIter |
createRegular(int[] permSourceArray) |
public static ArrayPermutationsIter createRegular(int[] permSourceArray)
public static ArrayPermutationsIter createByGroups(int[] groupSizesArray)
groupSizesArray
- . example [3,2] will create an array (0,1,2)(3,4)