Skip to content
DSA Visualizerpreview

Permutations (choose, explore, undo)

Choose any unused value, recurse, then undo the choice and try the next one.

O(n · n!) time · O(n) recursion depth space

Values1, 2, 3

Nothing chosen yet. Try each of 1, 2, 3 first.

Choice tree for 1,2,3: 1 calls so far; orderings found: none.
  1. go(): cur = []
  • compare
  • swap or write
  • settled

1 / 17

Speed

Space play · ← → step · Home End jump · drag the strip to scrub