#include
using namespace std;
int count=0;
//func to display the sequence
void dis(char a[],int n)
{
for(int jk=n-1;jk>=0;jk--)
{
cout< }
cout<<"\n";
}
//function to left shift last n elements
//of the array by one position
void shift(char a[],int n)
{
char s;
s=a[n-1];
for(int i=n-1;i>0;i--)
a[i]=a[i-1];
a[0]=s;
}
//func to find all possible arrangements
void per(char a[],int m,int n)
{
for(int i=0;i
if(m>1)
{
shift(a,m);
per(a,m-1,n); //genetrating the tree
}
else
{
dis(a,n); //displaying the leaf nodes of the tree
count++;
}
}
}
void main()
{
// char *a;
int n;
cout<<"Enter a no : ";
cin>>n;
char *a = new (char[n]);
for(int i=0;i
// dis(a,n);
cout<<"Possible permutations are :\n";
per(a,n,n);
cout<
}