Total permutation is an algorithm with a time complexity of: O(n!). I was giving a lecture to students two days ago. 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 6 types are summarized for the convenience of readers. All algorithms are written in JavaScript and can be run directly.
Algorithm 1: Exchange (recursion)
1.
2.
Full Permutation(Recursive Swap)
8. Mengliao Software Studio - Bosun Network Co., Ltd.
9. 2011.05.24