Produce a recursive method which takes a string of letters a

Produce a recursive method which takes a string of letters and returns all the n! permutations of that string.

For example, if the string is “abc”, the method should return the following strings:

abc acb bac bca cab cba

Solution

Answer:

#include <stdio.h>
#include <bits stdc++.h=\"\">
using namespace std;

void swap(char *a, char *b)
{
char temp;
temp = *a;
*a = *b;
*b = temp;
}
set<string> ss;

It will print all the permutations of the string

Produce a recursive method which takes a string of letters and returns all the n! permutations of that string. For example, if the string is “abc”, the method s

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site