Permutations

Generate all possible orderings of a set of elements.

Permutations Visualization

Ultra Premium Backtracking Engine

Permutations Visualizer

3 items
6 permutations
Step 1/0

Input Elements

Separate elements with commas. Recommended: up to 4 items.

Execution Feed

Live Algorithm Status

Current Prefix

Initializing...

Element

A

Element

B

Element

C

Animation Speed650 ms

Current Action

idle

Progress

0%

Synced Logic Panel

Backtracking Code

depth = 0

Why this matters

Each branch represents a partial permutation. The algorithm chooses one unused element, places it, recurses deeper, and then removes it to try another possibility.

Blue = active search states
Red = current recursion focus
Green = completed permutation

Complexity

Time Complexity: O(N!)
Space Complexity: O(N)

Pseudocode

function backtrack(path, remaining):
  if remaining is empty:
    save permutation
  for each element in remaining:
    choose element
    backtrack(path + element, remaining - element)
    undo choice