Skip to content

Implementations of various generating permutations algorithms in some common languages

Notifications You must be signed in to change notification settings

seri/permutations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Problem

Given n, generate all permutations from the string of size n that starts with 'a' to char('a' + n)

Solutions

Benchmarking

Benchmarking is done for n = 11. Time measured in seconds.

On my desktop

Algorithm C++ Lua Haskell
HeapPermute 3 54
Exeter 3 59
Bogomolny 7 60
Spreading 8 63
JohnsonTrotter 9 71
InverseSelect 15 70
Factoradic 21 84
Builtin 7 16
Injection 19
Select 22

On my laptop

Algorithm C++ Lua Haskell
HeapPermute 44
Exeter 25
Bogomolny 26
Spreading 29
JohnsonTrotter 26
InverseSelect 42
Factoradic 51
Builtin 44
Injection 46
Select 49

Remarks

  • HeapPermute is fastest
  • Haskell's performance is better than expected

Todo

  • Explain HeapPermute

About

Implementations of various generating permutations algorithms in some common languages

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published