void arrange(char *test,char *current, int n)
{
int i;
char temp;
if (n > 1)
{
for (i = 0; i < n; i++)
{
temp = current[0];
current[0] = current[i];
current[i] = temp;
arrange(test, current + 1, n - 1);
temp = current[0];
current[0] = current[i];
current[i] = temp;
}
}
else
{
printf(“%s \n”, test);
}
}
全排列
最新推荐文章于 2020-07-05 17:59:27 发布