How can I generate all permutations in a list of numbers?

How to create all possible permutations of a list of numbers in C?

As an example [1, 8, 12]will generate

[1, 12, 8],
[12, 8, 1],
[12, 1, 8], ...
+3
source share
1 answer

Look at this Johnson-Trotter Algorithm and applet exactly the way you want.

+2
source

Source: https://habr.com/ru/post/1776770/


All Articles