Can you give me an algorithm to print all permutations of a string, with no duplicates, both recursively and iteratively?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is actually a good question since permutations are used fairly frequently and can be hard to implement especially without redundancies. Of course the algorithm is pretty simple. Here is a good site to help you out (after googling around for a second). Check it out, hope its what you are looking for! http://www.bearcave.com/random_hacks/permute.html