MorphAL 0.1

fr.ign.cogit.alpage.morphal.algorithm.maths
Class Combinatorics

java.lang.Object
  extended by fr.ign.cogit.alpage.morphal.algorithm.maths.Combinatorics

public class Combinatorics
extends java.lang.Object

Combinatorics: maths class. Based mainly on the computation of sets of combinations without repetition.

Version:
0.1 (2011-01-09)
Author:
Eric Grosso - IGN / Laboratoire COGIT

Constructor Summary
Combinatorics()
           
 
Method Summary
static java.util.List<java.util.List<java.lang.Integer>> combination(int n)
          Compute and return the list of the lists of the set of all possible combinations without repetition for the numbers between 0 and n-1.
static double combination(int n, int k)
          Combination without repetition C(n,k).
static java.util.List<java.util.List<java.lang.Integer>> combinationString(int n)
          (Based on String) Compute and return the list of the lists of the set of all possible combinations without repetition for the numbers between 0 and n-1.
static double factorial(int n)
          Factorial.
static void main(java.lang.String[] args)
          Example through a main method.
static void showCombination(java.util.List<java.util.List<java.lang.Integer>> combination)
          Show a combination.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Combinatorics

public Combinatorics()
Method Detail

factorial

public static double factorial(int n)
Factorial.

Parameters:
n - an integer
Returns:
n! (n factorial)

combination

public static double combination(int n,
                                 int k)
Combination without repetition C(n,k).

Parameters:
n - an integer
k -
Returns:
C(n,k)

combination

public static java.util.List<java.util.List<java.lang.Integer>> combination(int n)
Compute and return the list of the lists of the set of all possible combinations without repetition for the numbers between 0 and n-1. For example, return the following combinations if n = 3, i.e. using the set {0,1,2,}: {0}, {1}, {2}, {0,1}, {0,2}, {1,2}, {0,1,2}. ATTENTION: Works fine for a value of n until 24. More than 24, it requires too much memory.

Parameters:
n -
Returns:
the list of the lists of the set of all possible combinations without repetition for the numbers between 0 and n-1

showCombination

public static void showCombination(java.util.List<java.util.List<java.lang.Integer>> combination)
Show a combination.

Parameters:
combination -

combinationString

public static java.util.List<java.util.List<java.lang.Integer>> combinationString(int n)
(Based on String) Compute and return the list of the lists of the set of all possible combinations without repetition for the numbers between 0 and n-1. For example, return the following combinations if n = 3, i.e. using the set {0,1,2,}: {0}, {1}, {2}, {0,1}, {0,2}, {1,2}, {0,1,2}. ATTENTION: Works only until 10 for the value of n (due to the fact that this method is based on String elements).

Parameters:
n -
Returns:
the list of the lists of the set of all possible combinations without repetition for the numbers between 0 and n-1

main

public static void main(java.lang.String[] args)
Example through a main method.

Parameters:
args -

MorphAL 0.1