print all Permutation of a string
void permutation(char *Pbegin, char *Pend)
{
if(!Pbegin || !Pend)
return;
///////////////////////
//if Pbegin equal to Pend
//this round is finished
//print
if(*Pend)
{
printf("%s",Pbegin);
}
///////////////////////
else
{
for(char *c=Pend; *c; c++)
{
// swap c and Pend
swap(c,Pend);
Pertumation(Pbegin, Pend+1);
swap(c,Pend);
}
}
}