all testcase not passing here id the link-
Recusrion dictionaery -
Please share the question
@pratyush63 here is the question ----- Take as input str, a string. Write a recursive function which prints all the words possible by rearranging the characters of this string which are in dictionary order larger than the given string
Your code is generating the correct permutations but not printing in correct order.
Consider a case: ABC
Your Code output:
ACB
BAC
BCA
CBA
CAB
Expected Output:
ACB
BAC
BCA
CAB
CBA
Refer this solution
also can u suggest me how can i use an another array to save the current outputs by an example
Actually the correct ordering is achieved without backtracking in this case.
Both with backtracking and without backtracking will give the correct permutations but arranged in different order.
Here in this problem you need the order formed just by the recursive way. But note that the parameters passed to recursive function are passed by value (as in string ) and not by reference. If it is passed by reference, you will notice that it will give the wrong permutations. In that case backtracking would be necessary.
okay sir got it thanks
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.