04 Try it yourself Interactive

Grow the tree, then un-grow it

Step through the same array, 1 2 3. Each row is one live decision on the path from the root down to where the search is now, cur is the working list, and a rose row is an un-choose actually happening. Then switch to permutations, which choose by swapping instead of pushing — same three steps, different tree. Nothing moves until you press Next.

Subsets · pick / not-pick
two branches per level
2–4 distinct whole numbers (0–99), commas or spaces.
Press Next to begin. Each press moves one step.


      
Level
Nodes visited0
Found0
Un-chooses0
step 0 / 0