To demonstrate the optimized version: #first set generates normally ABCD #ABCD is the first set, store internally BCD ACD ABD ABC AB AC BC AD BD CD A B C D #second set ABE -> look at slots A, B, E. All are the same, so arbitrarily check against "A" (ABCD) is ABE a subset of ABCD? NO -> print #ABE is the first set, store internally is AB a subset of ABCD? YES -> skip is AE a subset of ABCD? NO -> print is BE a subset of ABCD? NO -> print is A a subset of ABCD? YES -> skip is B a subset of ABCD? YES -> skip is E a subset of ABCD? YES -> skip #third set is ABC a subset of ABCD? YES -> skip #generates nothing, stores nothing #fourth set -> look at slots "E", "F". "F" is the smallest (empty), so we need to do -no- checks. EF E F We store 9 bytes and do 10 checks (determining "no checks" counts as a check). Note - the original powerset version would also require 10 checks, so we're optimal here.