Package mathvoyage.combinatorics
Class Combinatorics
java.lang.Object
mathvoyage.combinatorics.Combinatorics
The type Combinatorics.
-
Method Summary
Modifier and TypeMethodDescriptiondoublecombination(int n, int r) Returns combination value.generateSubsets(Integer[] set) Returns subsets of set.static CombinatoricsReturns the singleton instance of this class.doublenumberOfSubsets(int setSize) Return number of subsets of a set.doublepermutation(int n, int r) Returns permutation value.
-
Method Details
-
getInstance
Returns the singleton instance of this class.- Returns:
- The singleton instance
-
combination
public double combination(int n, int r) Returns combination value.- Parameters:
n- is the total number of items.r- is the number of items to be chosen.- Returns:
- the combination value.
-
permutation
public double permutation(int n, int r) Returns permutation value.- Parameters:
n- is the total number of items.r- is the number of items to be arranged.- Returns:
- the permutation value.
-
generateSubsets
Returns subsets of set.- Parameters:
set- is the set we want to show subsets- Returns:
- the subsets of a sets.
-
numberOfSubsets
public double numberOfSubsets(int setSize) Return number of subsets of a set.- Parameters:
setSize- is the number of elements of a set.- Returns:
- number of subsets of a set.
-