RK DSA Studio

Permutations

Enumerate every ordering of distinct elements by choosing an unused value for each position.

Remember: Choose unused → recurse → undo.

Example: [1,2] → [1,2] and [2,1].

Time: O(n² × n!) bound. Auxiliary space: O(n).

Formula: Choose an unused value → recurse → undo; n! permutations

Up to 5 distinct integers. This implementation scans candidates and uses a linear membership check. Its displayed bound accounts for that overhead; stored output uses O(n × n!) space.

Complexities describe the underlying algorithm; tutorial snapshots and rendering can use additional resources.

The interactive workspace loads here when JavaScript is available. You can still browse the learning notes and links above without it.