AlgoScope

Subsets

AlgorithmintermediateBacktrackingalso called power set

Include or exclude each element in turn; every leaf of that binary tree is one subset, 2^n in all.

Decision · step 2 of 24Enumeration: All subsets of three
102132i

Element 0 is 1. First branch: include it, chosen is now {1}. Go deeper.

Open in the player →or start at step 2

What you will see

A binary decision tree; each leaf is one subset.

How enumeration works →

Cost

BestO(2^n)
AverageO(2^n)
WorstO(2^n)
SpaceO(n)

How you work with it here

play it through, step one change at a time, scrub to any step, run it on your own input, predict what happens next.

Screen readers: Each node of the decision tree announces the choice made and whether it led to success, failure or further choices.

Reduced motion: Tree nodes appear and grey out in place; no travelling focus.

Before this

Leads to

Topics that need this one first.

Taught by the same lesson

Enumeration covers these too, in the same run.