Index
Problem list
Set
Partition
References
TODO list
P332
: Enumeration of all partitions of an integer $n$
P332
:
Enumeration of all partitions of an integer $n$
Input:
Two integers $n$ and $k$.
Output:
All partitions $D(n, k)$ of $n$ into distinct parts of size at most $k$.
Complexity:
$O(N)$ total time. E.g., $D(10, 5) = \{\{5, 4, 1\}, \{5, 3, 2\}, \{4, 3, 2, 1\}\}$ and $D(11, 4) = \emptyset$.
Comment:
$N$ is the number of partitions.
Reference:
[
Rasmussen1995
] (
Bibtex
)