









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);
}
}
}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。