이 프로그램을 사용했는지, 역 추적 알고리즘의 시간 복잡도를 계산하는 방법은 무엇입니까?역 추적 알고리즘의 시간 복잡도를 계산하는 방법
/*
Function to print permutations of string This function takes three parameters:
1. String
2. Starting index of the string
3. Ending index of the string.
*/
void swap (char *x, char *y)
{
char temp;
temp = *x;
*x = *y;
*y = temp;
}
void permute(char *a, int i, int n)
{
int j;
if (i == n)
printf("%s\n", a);
else
{
for (j = i; j <= n; j++)
{
swap((a+i), (a+j));
permute(a, i+1, n);
swap((a+i), (a+j)); //backtrack
}
}
}
들여 쓰기를 수정하십시오. –