0

I have a little problem I have some sets for example:

{1},{1, 2},{2},{2, 3},{3},{4},{4,5},{5}

and I need to get group or groups from these sets, which will contains elements from 1 to 5, so:

{1},{2},{3},{4},{5}
{1},{2,3},{4,5}
{1,2},{3},{4,5}
etc.

I need to get all complete combinations. How to do this effective? I was thinking about power set, but I guess, that it isn't best idea. Thanks in advance for your help.

Figa
  • 55
  • 1
  • 9
  • possible duplicate of [How to find all partitions of a set](http://stackoverflow.com/questions/20530128/how-to-find-all-partitions-of-a-set) – ruakh Feb 05 '15 at 03:02
  • I think, that it isn't the same problem. I don't want to find all partitions. I have some and i need to find the distinct. – Figa Feb 05 '15 at 03:06

0 Answers0