void permutation(string s, int n, int start = 0)
{
if(start == n)
{
string temp = s.substr(0, n);
cout << temp << endl;
}
else
{
for(int i = start; i < s.size(); i++)
{
char temp = s[start];
s[start] = s[i];
s[i] = temp;
permutation(s, n, start + 1);
s[i] = s[start];
s[start] = temp;
}
}
}
posted on 2007-06-02 23:58
AIFantasy 阅读(277)
评论(0) 编辑 收藏 引用 所属分类:
算法设计