觉得自己的程序写的太蠢,求指点。
竟然用到了set和递归,肯定内存占用很大,
求改进指点。谢谢。
// test102.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include
#include
#include
using namespace std;
void DoCombine(set
{
if (mystr.length()==0) return;
mystrset.insert(mystr);
for (int i=0; i
string tmp=mystr;
tmp.erase(i, 1);
DoCombine(mystrset, tmp);
}
}
int _tmain(int argc, _TCHAR* argv[])
{
set
DoCombine(mystrset, "abcd");
for (set
cout
getchar();
return 0;
}