AlgoScope

Subset Enumeration

TechniqueintermediateBit Manipulation

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
507192

mask 0 = 000: the subset { }. All bits off is the empty set.

Open in the player →or start at step 2

What you will see

The binary counter ticks; the chosen elements below it change with each bit pattern.

How bitmask works →

Cost

BestO(2^n)
AverageO(2^n)
WorstO(2^n)
SpaceO(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.

Before this

Related

Taught by the same lesson

Bitmask covers these too, in the same run.