Multiset
A multiset is a modification of the concept of a set that allows for multiple instances of the same element. Unlike regular sets where each element appears exactly once, multisets track the multiplicity (number of occurrences) of each element.
A multiset on a set is specified by its multiplicity function:
We get the indexed family , where is the number of occurrences of .
Key properties:
- Order is irrelevant (like regular sets)
- Elements can appear multiple times
- Elements can have zero occurrences
- The cardinality: is
Notation: If is a multiset, we can denote it as:
- (listing all occurrences)
- (using superscripts for multiplicity)
Examples
The string “hello” as a multiset:
Chemical formula H₂O as a multiset:
permutation of a multiset
Permuting a multiset is like permuting a string of characters:
There are ways to permute a set with elements, but for a multiset, we need divide by the amount of permutations of equal elements whose order doesn’t matter (eliminating all those sub-trees). E.g. has permutations, but only unique ones.
Let be a multiset with elements where is an element and is the multiplicity of .
The number of unique permutations of is: