Dear all, was wondering if i) there is a name for the following combinatorics problem; ii) is there a way to code it within Matlab and generate all results?
I have N elements, and would like to generate all possible permutations of non-repeated combinations with varying bracket sizes. For instance, for N = 5 elements, we have the following possible permutations:
- Max group combination size of 5: (ABCDE)
- Max group combination size of 4: (A) (BCDE); (BCDE) (A); (B) (ACDE); (ACDE) (B); (C) (ABDE); (D) (ABCE); (E)(ABCD) etc.
- Max group combination size of 3: (AB) (CDE); (A) (B) (CDE); (AC) (BCD); (A) (C) (BCD) etc.
- Max group combination size of 2: (AB) (CD) (E); (AB) (C) (D) (E); (AB) (CE) (D) etc.
- Max group combination size of 1: (A) (B) (C) (D) (E); (B) (C) (D) (E) (A); etc.
Note that, within the brackets, order does not matter i.e. they are just combinations. But beyond the brackets, permutation must occur, for instance, (AB) (CDE) and (CDE) (AB) are two possible permutations.
My apologies in advance for the unclear/vague wording. Thank you for your help!
Best Answer