摘要: 问题:给定字符串S,生成该字符串的全排列。方法1:依次从字符串中取出一个字符作为最终排列的第一个字符,对剩余字符组成的字符串生成全排列,最终结果为取出的字符和剩余子串全排列的组合。#include <iostream>#include <string>using namespace std;void permute1(string prefix, string str){ if(str.length() == 0) cout << prefix << endl; else { for(int i = 0; i < str.length(); 阅读全文
posted @ 2011-06-16 16:34 摇风清影 阅读(6744) 评论(3) 推荐(0) 编辑