【发布时间】:2011-07-18 19:54:25
【问题描述】:
发件人:Are there any better methods to do permutation of string?
这个函数的复杂度是多少???
void permute(string elems, int mid, int end)
{
static int count;
if (mid == end) {
cout << ++count << " : " << elems << endl;
return ;
}
else {
for (int i = mid; i <= end; i++) {
swap(elems, mid, i);
permute(elems, mid + 1, end);
swap(elems, mid, i);
}
}
}
【问题讨论】:
标签: algorithm string complexity-theory