Documentation of 'cc.redberry.core.combinatorics.Combinatorics' Java class
Combinatorics
cc.redberry.core.combinatorics

Class Combinatorics



  • public final class Combinatorics
    extends java.lang.Object
    This class provides factory and utility methods for combinatorics infrastructure.
    Since:
    1.0
    • Method Detail

      • createIntGenerator

        public static IntCombinatorialGenerator createIntGenerator(int n,
                                                                   int k)

        Returns an IntCombinatorialGenerator object, which allows to iterate over all possible unique combinations with permutations (i.e. {0,1} and {1,0} both appears for k=2) of k numbers, which can be chosen from the set of n numbers, numbered in the order 0,1,2,...,n. The total number of such combinations will be n!/(n-k)!.

        For example, for k=2 and n=3, this method will produce an iterator over the following arrays: [0,1], [1,0], [0,2], [2,0], [1,2], [2,1].

        Parameters:
        n - number of elements in the set
        k - sample size
        Returns:
        an iterator over all combinations (with permutations) to choose k numbers from n numbers.
        See Also:
        IntCombinatorialGenerator

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.