I got this set of string such as “12 13 2 1 444”
I want to generate all of different permutation of this set of integers.
I mean
"12 13 2 1 444"
"13 12 2 1 444"
"12 13 1 2 444"
"1 12 13 2 444"
.....
Could any one help me with Java?
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.
There are many ways to do this. I think that the best way is to break this down into two steps:
You can split the string into individual values by using the
String.splitmethod:Once you have this, you can generate all permutations with one of many permutation generation functions. Leon’s link will probably help out here.