全排列算法
全排列算法是日常经常用到的一个算法,这里使用递归解决。源代码:public class 全排列 { static int temp; public static void main(String[] args) { int[] arr = new int[] {1,2,3}; perm(arr, 0, arr.length); } static void perm(int[] arr, int p, int q) { if (p == q) { print(arr);
原创
2020-10-27 23:08:22 ·
189 阅读 ·
0 评论