就是怎么理解递归 for循环 递归
就是怎么理解递归 for循环 递归如
void swap(int &a, int &b)
{
int temp;
temp = a;
a = b;
b = temp;
}
//递归函数
void fullPermutation(int * c, int start, int end, int number) {
if (start >= end) {
for (int i = 0; i<number; i++) {
cout << c[i];
}
cout << endl;
total++;
}
else
{
for (int i = start; i <= end; i++)
{
swap(c[start], c[i]);
fullPermutation(c, start + 1, end, number);
swap(c[start], c[i]);
}
}
不理解怎么,,,