Skip to content

Steinhaus–Johnson–Trotter algorithm with Even speedup

Notifications You must be signed in to change notification settings

corentinway/permutation_way_rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Passing

About

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

Roadmap

  • 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.

Examples

See integrations tests in the folder tests.

About

Steinhaus–Johnson–Trotter algorithm with Even speedup

Resources

Stars

Watchers

Forks

Packages

No packages published