Example of Java algorithm for solving Full Permutation Problem Based on recursion
This paper describes the Java algorithm based on recursion to solve the full permutation problem. Share with you for your reference, as follows:
Permutation problem
Let r = {R1, R2,..., RN} be n elements to be arranged, RI = R - {RI}. The full arrangement of elements in set X is denoted as perm (x). (RI) perm (x) indicates the perm obtained by adding the prefix RI to each perm of the full perm (x). The complete arrangement of R can be summarized as follows:
When n = 1, perm (R) = (R), where R is the only element in the set;
When n > 1, perm (R) consists of (R1) perm (R1), (R2) perm (R2), (R3) perm (R3).... (RN) perm (RN).
Operation results:
For more information about Java algorithms, readers who are interested can see the topics on this site: Java data structure and algorithm tutorial, summary of Java DOM node operation skills, summary of java file and directory operation skills, and summary of Java cache operation skills