Package mathvoyage

Class vmath.combinatorics

java.lang.Object
mathvoyage.vmath.combinatorics
Enclosing class:
vmath

public static class vmath.combinatorics extends Object
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 Details

    • combinatorics

      public combinatorics()
  • Method Details

    • combination

      public static double combination(int n, int r)
      Calculates the combination value.
      Parameters:
      n - the n
      r - the r
      Returns:
      the combination value.
    • permutation

      public static double permutation(int n, int r)
      Calculates the permutation value.
      Parameters:
      n - the n
      r - 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

      public static ArrayList<ArrayList<Integer>> generateSubsets(Integer[] set)
      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