I am writing Digital Fountain in C #. Part of this system creates integers for me, I need to find combinations of sets that create can leave me with a set of only one element. What is the fastest way to do this?
Set A: 1,2,3,4,5,6
Set B: 1,2,3,4,6
Set C: 1,2,3
Set D: 5,6
Solutions:
A - B => 5
A - (C + D) => 4
I do not need to find all the combinations, enough to find as many unique numbers as possible. This may be possible to use to create a more efficient algorithm.
An important point that I forgot to mention: I don’t know in advance how many sets there are, instead I add them one by one and each time I have to determine if I will find every number that I need. Thus, the algorithm should be something that can be run in stages as new sets are added.
Nb. Decisions in C # get bonus points;)