Hey,
I am trying to find a solution for the following problem:
I want to generate every possible combination of elements in a vector. The vector elements should always be split up in 2 groups. The groups can vary in size (number of elements), but all elements have to been included in the groups. The number of elements in a vector varies from 3 to 12.
Vector1 = [1 2 3 4]
Possible subgroups:
1 vs. 2,3,4
2 vs. 1,3,4 3 vs. 1,2,4 4 vs. 1,2,3 1,2, vs. 3,4 1,3 vs. 2,4 1,4 vs. 2,3
Vector2 =[1 2 3 4 5 6]
Size Subgroup1 = 1, Subgroup2 = 5
1 vs. 2,3,4,5,6 2 vs. 1,3,4,5,6 … 6 vs 1,2,3,4,5
Size Subgroup1 = 2, Subgroup2 = 4
1,2 vs. 3,4,5,6 1,3 vs. 2,4,5… …
Size Subgroup1 = 3, Subgroup2 = 3
1,2,3 vs 4,5,6 1,2,4 vs 3,5,6
Size Subgroup1 = 4, Subgroup2 = 2
…
Size Subgroup1 = 5, Subgroup2 = 1
…
I have searched for a solution but I haven´t found one yet. Thanks!
Stephan
Best Answer