全排列(cpp)
void process1(string str, int i){
if(i == str.length()){
cout << str << endl;
}
for(int j = i;j < str.length(); j++){
swap(str[i], str[j]);
process1(str, i+1);
}
}
void printAllPermutations1(string str){
process1(str, 0);
}
相关链接如下:
知乎:littledy
GitHub主页:https://github.com/littledy
github.io:https://littledy.github.io/
欢迎关注个人微信公众号:小邓杂谈,扫描下方二维码即可
作者:littledy
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文链接,否则保留追究法律责任的权利。