M
megaduks
Hello everyone,
I'm struggling with the following problem. I have a set (implemented as
a TreeSet, but this can be easily changed). I want to generate all
possible partitions of this set into two disjoint subsets. Of course, I
can generate all subsets of a given set and then use a subset along
with its complement, but this approach generates every partition twice.
Is there a better and more efficient way? Maybe a utility class? I'll
be grateful for all hints and remarks.
Best regards, Mikolaj
I'm struggling with the following problem. I have a set (implemented as
a TreeSet, but this can be easily changed). I want to generate all
possible partitions of this set into two disjoint subsets. Of course, I
can generate all subsets of a given set and then use a subset along
with its complement, but this approach generates every partition twice.
Is there a better and more efficient way? Maybe a utility class? I'll
be grateful for all hints and remarks.
Best regards, Mikolaj