递归——数组全排列

【递归——数组全排列】方法一 深度

import java.util.Scanner; public class Main {public static void main(String[] args) { //Scanner sc = new Scanner (System.in); int sz[] = {1,2,3,4,5,6}; digui(sz,0,5); } public static void swap(int aa[],int m,int n) { int x =aa[n]; aa[n]=aa[m]; aa[m]=x; } public staticvoid digui(int aa[],int start ,int end) { if(start==end) { for(int i=0; i

方法二 字典序递归
public class Main { static int aa[]= {1,2,3}; static int bb[]=new int[aa.length]; public static void main(String[] args) { pailie(0); } public static void pailie(int dibiao) { if(dibiao==aa.length) { shuchu(); return; } else { for(int i=0; i

    推荐阅读