How do I generate all permutations of a list of numbers?

前端 未结 1 1145
南方客
南方客 2020-12-21 09:39

How do I generate all possible permutations of a list of numbers in C?

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

[1, 12, 8],
[12, 8, 1],
[12,          


        
相关标签:
1条回答
  • 2020-12-21 09:53

    Have a look at this Johnson-Trotter Algorithm and applet it is exactly what you want.

    0 讨论(0)
提交回复
热议问题