I have N number of sets Si of Numbers, each of a different size. Let m1, m2, ... mn be the sizes of respective sets (mi = | Si |), and M be the size of the largest set. I have to find common subsets that have at least two numbers in them. Example:
Set Items
1 10,80,22
2 72, 10, 80, 26,50
3 80,
4 10, 22
5 22, 72, 10, 80, 26,50
So the result will be like that
Items Found in sets
10, 22 1, 4
10, 80 1, 2, 5
10, 80, 22 1, 5
10, 72, 80, 26, 50 2, 5
So how to automate this problem and what is the expected complexity for respective solution? I need it to be as fast as possible.