Total permutation is an algorithm with a time complexity of: O(n!). I was giving a lecture to students two days ago and I accidentally thought of this problem. I came back and summarized it. It can be solved by 7 algorithms, among which dynamic loops are similar to backtracking algorithms. It is relatively cumbersome to implement, so I have summarized 6 types for the convenience of readers. All algorithms are written in JavaScript and can be run directly.
Algorithm 1: Exchange (recursion)
Full Permutation(Recursive Swap)
Mengliao Software Studio - Bosun Network Co., Ltd.
2011.05.24
Full Permutation(Recursive Link)
Mengliao Software Studio - Bosun Network Co., Ltd.
2012.03.29
Full Permutation(Recursive Backtrack)
Mengliao Software Studio - Bosun Network Co., Ltd.
2012.03.29
2012.03.29