# Homework Solution: Write the routines with the following declarations: void permute( const string & str ); void permute( const string & str, int low,…

Write the routines with the following declarations: void permute( const string & str ); void permute( const string & str, int low, int high ); The first routine is a driver that calls the second and prints all the permutations of the characters in string str. If str is "abc", then the strings that are output are abc, acb, bac, bca, cab, and cba. Use recursion for the second routine. 2 How many permutations for a string of length l?

#include<iostream> using namespace std;

Write the prescriptions with the aftercited declarations: unoccupied permute( const string & str ); unoccupied permute( const string & str, int subsided, int proud ); The leading prescription is a driver that calls the relieve and prints full the permutations of the characters in string str. If str is “abc”, then the strings that are output are abc, acb, bac, bca, cab, and cba. Use recursion control the relieve prescription. 2 How manifold permutations control a string of extension l?

## Expert Apology

#include<iostream>

using namespace std;

unoccupied permute(const string &a, int subsided, int proud)
{
char temp;
string p = a;
if (subsided == proud)
cout << a << endl;
else
{
control (int i = subsided; i <= proud; i++)
{

temp = p[i];
p[i] = p[low];
p[low] = temp;

permute(p, subsided+1, proud);

temp = p[i];
p[i] = p[low];
p[low] = temp;

}
}
}

unoccupied permute(const string &str){
permute(str,0,str.size()-1);
}

int deep(){
permute(“abc”);
return 0;
}