// STRING PERMUTATIONS
void swap(char &a, char &b)
{
a = a^b;
b = a^b;
a = a^b;
}
void _strPermute(char *s, int n, int pos)
{
if (pos == n-1)
{
cout << s << endl;
return;
}
for (int i = pos + 1; i < n; i++)
{
swap(s[pos], s[i]);
_strPermute(s, n, pos + 1);
swap(s[pos], s[i]);
}
}
void printStringPermutations(char *s, int n)
{
if (n < 2) return;
_strPermute(s, n, 0);
}
Wednesday, May 18, 2016
[BackTracking] [C++] Permutations of given string
Subscribe to:
Posts (Atom)
GraphQL
GraphQL What is GraphQL It is a specification laid out by Facebook which proposed an alternative way to query and modify data. Think o...
-
Hi, I'm currently working as a software developer in the logistics industry in San Francisco. My aim is to impact billions of pe...
-
GraphQL What is GraphQL It is a specification laid out by Facebook which proposed an alternative way to query and modify data. Think o...
-
DHCPerf is an open source load testing tool for DHCP-Server setups. The tool is capable of generating DHCP Client traffic with a customizabl...