Given a list of sets...
var sets = new List<HashSet<int>>(numTags);
How can I remove all the sets that are a proper subset of another?
Is this the best way to do it?
for (int i = 0; i < sets.Count; ++i)
{
for (int j = 0; j < sets.Count; ++j)
{
if (i != j && sets[i].IsProperSubsetOf(sets[j]))
{
sets.RemoveAt(i--);
}
}
}
I'm decrementing i
because I assume everything gets nudged down one after it gets removed so I have to check that slot again.