Subset Enumeration
Counting from 0 to 2^n - 1 enumerates every subset; sub = (sub - 1) & mask enumerates submasks.
Decision · step 2 of 10Bitmask: Every subset of three
mask 0 = 000: the subset { }. All bits off is the empty set.
What you will see
The binary counter ticks; the chosen elements below it change with each bit pattern.
Cost
| Best | O(2^n) |
|---|---|
| Average | O(2^n) |
| Worst | O(2^n) |
| Space | O(1) |
How you work with it here
play it through, step one change at a time, run it on your own input, try operations in any order.
Screen readers: Each bit announces its position and value; each step announces the operation and the resulting number in binary and decimal.
Reduced motion: Bits flip with a crossfade; masks appear in place.