Number of cases we can segmentize a multiset into segments where each segment has distinct elements

19 Views Asked by At

We define the set S as $S = \{(a_1, f_1), (a_2, f_2), ..., (a_i, f_i)\}$, where each fi is the frequency that ai is repeated in the multiset T.

For example, given $S = \{(a_1, 1), (a_2, 2), (a_3, 1)\}$ results in the multiset T={a1, a2, a2, a3}. Now, we can segmentize the multiset into six different cases in which each segment includes distinct ai as follows:

$1:\{\{a_1,a_2\},\{a_2,a_3\}\}$

$2:\{\{a_1,a_2,a_3\},\{a_2\}\}$

3:$\{\{a1,a2\},\{a2\},\{a3\}\}$

$4:\{\{a_1\},\{a_2\},\{a_2,a_3\}\}$

$5:\{\{a_1,a_3\},\{a_2\},\{a_2\}\}$

$6:\{\{a_1\},\{a_2\},\{a_2\},\{a_3\}\}$

  • Note that the order of elements in each segment does not matter, e.g., $\{a_1,a_2\} = \{a_2,a_1\}$

  • Note that each segment has distinct elements.

Now, I am looking for a formula that counts the number of cases (six cases in the example) where we can segmentize multiset T.

The code that creates these cases is in the below link, but I am looking for a formula that mathematically gives us the number of cases.

https://stackoverflow.com/questions/54596127/how-to-find-all-partitions-of-a-multiset-where-each-part-has-distinct-elements