set partitioning

Edward Elliott nobody at 127.0.0.1
Tue May 2 04:45:59 EDT 2006


hymort at hotmail.com wrote:

> For the list [1,2,3,4], I'm looking for the following for k = 2:
> 
> [[1,2], [3,4]]
> [[1,3], [2,4]]
> [[1,4], [2,3]]

That's not what you asked for the first time.  You said you wanted "m
non-empty, disjoint subsets", but the subsets above are clearly not all
disjoint; only those on the same line are.  It sounds like what you really
want is the "powerset of non-empty, disjoint partitions of size k".



More information about the Python-list mailing list