Package mathvoyage
Class vmath.combinatorics
java.lang.Object
mathvoyage.vmath.combinatorics
- Enclosing class:
vmath
Contains functions to calculate combination, permutations and vice versa of numbers and sets of numbers.
Also contains functions to generate subsets of a set of numbers.
- Author:
- Takia Farhin
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doublecombination(int n, int r) Calculates the combination value.generateSubsets(Integer[] set) Returns the number of subsets of a set.static doublenumberOfSubsets(int n) Returns the number of subsets of a set.static doublepermutation(int n, int r) Calculates the permutation value.
-
Constructor Details
-
combinatorics
public combinatorics()
-
-
Method Details
-
combination
public static double combination(int n, int r) Calculates the combination value.- Parameters:
n- the nr- the r- Returns:
- the combination value.
-
permutation
public static double permutation(int n, int r) Calculates the permutation value.- Parameters:
n- the nr- the r- Returns:
- the permutation value.
-
numberOfSubsets
public static double numberOfSubsets(int n) Returns the number of subsets of a set.- Parameters:
n- The number of elements in the set- Returns:
- The number of subsets
-
generateSubsets
Returns the number of subsets of a set. The set have to be an array of integers.- Parameters:
set- The set- Returns:
- All the subsets possible
-