Iterating Permutations. With an Implementation in Rust.

In many practical combinatorial problems there arises the need to iterate over all permutations of a given set. Since the number of permutations increases in factorial time, that is, n! for a n-element set, this can lead to a huge amount of data.

Permutations of a given list [x1, x2, …, x_n] can be computed relatively easily by a recursive algorithm like this:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
applied.math.coding

applied.math.coding

526 Followers

I am a mathematician and software developer who likes writing advanced code and to do research in applied and pure mathematics.