字符串的全排列
递归,注意还原,注意从当前字符开始,即i=from
public static void permutation(char[] ch, int from, int to){
if(to <= from){
System.out.println(String.valueOf(ch));
} else{
for(int i = from; i <= to; i++){
char temp = ch[from];
ch[from] = ch[i];
ch[i] = temp;
permutation(ch,from+1,to);
temp = ch[from];
ch[from] = ch[i];
ch[i] = temp;
}
}
}