今天学习了如何输出组合数 大家知道 算组合数可以利用递归的办法 现在也可以利用递归来写出有多少种方案
public class zuhe{
private char[] p;
private boolean[] v;
public zuhe(char[] p){
this.p = p;
v = new boolean[p.length];
}
public void c(int t; int index){
if( t == 0){
for(int i = 0 ; i < v.length;i++){
if(v[i] == true){
System.out.print(p[i]+" ");
}
}
}
System.out.println();
return ;
if(index >= p.length){
return;
}
v[index] = true;
c(t-1,index+1);
v[index] = false;
c(t,index+1);
}
}