I'm looking for an algorithm in c# that solves a combinatorics problem:
Assume i have the objects 1,2,3,4
I want to get all possible ways to group these object in multiple groups, that each time contain all objects. Order is not important. Example:
<1,2,3,4
<1,2 / 3,4
<1,3 / 2,4
<1,4 / 3,2
<1,2,3 / 4
<1,2,4 / 3
<1,3,4 / 2
<2,3,4 / 1
<1 / 2 / 3 / 4
In the first case there is one group that contain all 4 objects. Next are cases with 2 groups that contain all objects in many different ways. The last case is 4 groups, that each one contains only one object.