java.io.Serializable, java.util.Comparator<int[]>public static class Combinations.LexicographicComparator
extends java.lang.Object
implements java.util.Comparator<int[]>, java.io.Serializable
n) in the input array,
in reverse order.
For example if c is {3, 2, 1}, and n
is 3, the method will return 18.| Constructor | Description |
|---|---|
LexicographicComparator(int n,
int k) |
| Modifier and Type | Method | Description |
|---|---|---|
int |
compare(int[] c1,
int[] c2) |
|
int |
getK() |
Gets the number of elements in each combination.
|
int |
getN() |
Gets the size of the set from which combinations are drawn.
|
public LexicographicComparator(int n,
int k)
n - Size of the set from which subsets are selected.k - Size of the subsets to be enumerated.public int getN()
public int getK()
public int compare(int[] c1,
int[] c2)
compare in interface java.util.Comparator<int[]>java.lang.IllegalArgumentException - if the array lengths are not
equal to k.java.lang.IllegalArgumentException - if an element of the array is not
within the interval [0, n).Copyright © 2017 The Apache Software Foundation. All rights reserved.