#iterator #permutation #permutations-iter

permutations_iter

Generate permutations iteratively without recursion in O(n) time

2 releases

0.1.1 Feb 24, 2023
0.1.0 Feb 24, 2023

#2459 in Algorithms

MIT license

6KB
93 lines

permutations_iter

An iterative permutation generator without recursion for Rust.

Iterator Permutations::of(n) generates permutations of 0..n iteratively using Steinhaus-Johnson-Trotter algorithm with Even's modification.

Each next() call has $O(n)$ time and space complexity.

Not optimized. At all. Any improvements are welcome.

Published under MIT license.

No runtime deps