Thursday, July 30, 2009

Write a program to get permutations of a string in c++?

it may be of any order plz help me

Write a program to get permutations of a string in c++?
Are you trying to display all the possible permutation of a string?





If so, then you can do it by using a recursive function that temporarily stores a copy of the string.





Break the string down into the chars and then change it around.
Reply:00101011
Reply:i think you cant get permutations by using factorials with numbers, transfer that into strings for permutations, its the same logic.








int factorial(int n){ if(n == 0)return 1;else n * factorial(n-1);}


No comments:

Post a Comment