Ahoj,jak můžu co nejvíc zrychlit tento program?:
#include <string>
#include <iostream>
using namespace std;
int count=0;
void string_permutation( std::string& orig, std::string& perm )
{
if( orig.empty() )
{
std::cout<<perm<<std::endl;
count=count+1;
return;
}
for(int i=0;i<orig.size();++i)
{
std::string orig2 = orig;
orig2.erase(i,1);
std::string perm2 = perm;
perm2 += orig.at(i);
string_permutation(orig2,perm2);
}
}
int main()
{
std::string orig="0123456789";
std::string perm;
string_permutation(orig,perm);
cout<<"\npermutace: "<<count<<"\n";
system("pause");
return 0;
}