Its a simple backtracking problem. U may call backtrack as recursive solution. Well, i cant remember any iterative way for it. If u use C++ , then u will find a function for all possible permutation in header. the name of the function is next_permutation() . U may try it also. I f u need , i can give u C++ code for all possible permutation and ya combination too...just a little modification. ;)
All permutations of a given string.
Its a simple backtracking problem. U may call backtrack as recursive solution. Well, i cant remember any iterative way for it. If u use C++ , then u will find a function for all possible permutation in header. the name of the function is next_permutation() . U may try it also. I f u need , i can give u C++ code for all possible permutation and ya combination too...just a little modification. ;)