I have some fixed sets of integers, with distict increasing values in each a set, for example:
{1, 2, 4}, {1, 3}, {2, 4}, {2, 7}, {3, 6}, {5, 6}, {3, 5, 7}...
Is there any algorithm or better C# code, generating all possible combinations of
given sets but without repetition of their internal integers, i.e.
[{1, 2, 4}, {3, 6}] <--- all integers are unique
[{1, 2, 4}, {3, 5, 7}] <--- all integers are unique
[{1, 3}, {2, 4}, {5, 6}] <--- all integers are unique.
...?
------------------------------------------------
Here is possible organization of input data:
var set1 = new HashSet<int>() { 1, 2, 4 };
var set2 = new HashSet<int>() { 1, 3 };
var set3 = new HashSet<int>() { 2, 4 };
var set4 = new HashSet<int>() { 2, 7 };
var set5 = new HashSet<int>() { 3, 6 };
var set6 = new HashSet<int>() { 5, 6 };
var set7 = new HashSet<int>() { 3, 5, 7 };
var inputList = new List<HashSet<int>>();
inputList.Add(set1);
inputList.Add(set2);
inputList.Add(set3);
inputList.Add(set4);
inputList.Add(set5);
inputList.Add(set6);
inputList.Add(set7);
I need to obtain a list (or collection) of all possible lists (i.e. combinations) of
given sets from inputList with
unique integers in each internal list (combination).