I have a problem in printing out the permutation of various characters grouped together like
string 0 has"ABC"
1: "DEF"
2:"GHI"
3:"JKL"
4."MNO"
5."PRS"
6."TUV"
7."WXY"
now i have to print all the permutation of the characters to form 1 letter to 12 letter words
lets say i have 2512
then my possible permutation will be 81 strings like GPDG GPDH GPDI GPEG GPEH GPEI GPFG GPFH GPFI GRDG GRDH GRDI ........
and the number can be even 25123 or longer
so one of the possible approach is recursion:
so I tried:
char rec(string in[],vector<int> brand,int i,int j,int l)
{
if(j==l){
j=0;
name+=rec(in,brand,++i,++j,l);
--l;
return in[brand[i]][j];
}
if(l==-1)
{
l=2;j=0;i+=1;
}
name+=rec(in,brand,i,++j,l);
}
PLZ help me as I am learning recursion by myself and its a very hard topic.......