# Find sets which are subsets of the given search set?

The problem is the following: You are given a collection( set, list, whatever ) C of sets, and you are given a search set S. We want to find among all sets in C the ones which are subsets of S. Hence, the statement would be: What is the best way to return all sets from C which are a subset of search set S?

• See cs.stackexchange.com/q/120493/755, cs.stackexchange.com/q/75915/755, as well as cs.stackexchange.com/q/7701/755, cs.stackexchange.com/q/109399/755 (take complements of all sets)
– D.W.
Commented Feb 24, 2022 at 7:17
• I'm not looking for element of C to be superset of S, but for element of C to be subset of S, so the other way around. Commented Feb 24, 2022 at 21:52
• If you "take complements of all sets", that swaps superset vs subset, showing a close connection between those two problems and allowing you to apply techniques for one to solve the other.
– D.W.
Commented Feb 24, 2022 at 22:23
• @D.W. if the concourse is very large and each set is very small relatively, wouldn't "take complement" immediately involve a huge factor in both time and space complexity for every operation?
– SOFe
Commented Apr 15 at 5:40