This is an implementation of the Steinhaus Johnson Trotter algorithm with Even's speedup. This algorithm compute all permutations of a given input vector.
Given a vector of [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
we expect to have 3,628,800
permutations.
They was found in 800.475710
milliseconds without any threads. The test with CPU Intel(R) Core(TM) i5 @ 6.30 GHz and 16 Gb of RAM
The roadmap bellow suggest some path to make it faster again.
It permutes any type that implements the traits :
Eq
,Clone
Ord
,PartialOrd
- and
PartialEq
- I will use threads to have it faster.
- do benchmarks
I may had a max
options in order to stop the computation of permutation. I may be a number of a function
that test some conditions. An interrupt
function may be added to stop the research of the next permutations.
See integrations tests in the folder tests.