void AllSortCore(char *str,int begin,int end); void AllSort(char *str) { if(str == NULL) return ; int n = strlen(str); AllSortCore(str,0,n-1); } void ... ...
void AllSortCore(char *str,int begin,int end); void AllSort(char *str) { if(str == NULL) return ; int n = strlen(str); AllSortCore(str,0,n-1); } void AllSortCore(char *str,int begin,int end) { if(end <=1) return ; if(begin == end) { cout<<str<<endl; } for(int j = begin;j<=end;++j) { swap(str[j],str[begin]); AllSortCore(str,begin+1,end); swap(str[j],str[begin]); } }