Efficent algorithm for find the subset of a set of 8 bit integers, whose elements do not contain each other which has the maximum number of elements

67 Views Asked by At

I want to find a subset of the set of all 8 bit unsigned integers, this subset contains elements that do not contain another (x contains y if x & y == x). The subset should have the maximum number of elements. Beside brute forcing, I couldn't think of a way to efficiently generate this set.

1

There are 1 best solutions below

0
On BEST ANSWER

Sperner's theorem: an antichain of subsets of a set of $n$ elements has cardinality at most $${n \choose \lfloor n/2 \rfloor}$$ In this case $n=8$, and the antichain consists of all $8$-bit integers with $4$ ones.