First of all: no, this is not homework! This fits into a solver I'm writing for a game. I just reduced the problem to this concise statement:
Given a set of sets S, find and remove any elements of S which are subsets of other elements of S.
Domain
1 <= |S| <= C^K
1 <= |Si| <= K
2 <= C <= 10
10 <= K <= 500
Details
Si is a subset of [0, K)
min(|Si|) >= logC(|S|)
My current approach is to keep each set inside S sorted via what I call a "NatSet" which is simply a bool[K]
. I then sort S by |Si| and do a O(|S|^2) search to find elements which are subsets of other elements. This, unfortunately, is too slow for my target values C=6 and K=16*9.