字符串全排列

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]);
    }
}
原文地址:https://www.cnblogs.com/susidian/p/10013130.html