I have 5 strings, such as: "one", "two", "three", "four", and "five". I need to get all permutations of these words. I've explored all internet resources, but all solutions are so bulky and it's hard for me to understand it and integrate it to my program.
So, maybe you know any easy solution how to get permutations.
For example string are 1 2 3, it would: 123, 132, 213, 231, 312, 321.
Thanx.
Dasharnb777
0
Newbie Poster
Recommended Answers
Jump to Postprivate static void Test() { List<string> list = new List<string>() { "A", "B", "C" }; IList<IList<string>> perms = Permutations(list); foreach (IList<string> perm in perms) { foreach (string s in perm) { Console.Write(s); } Console.WriteLine(); } } private static IList<IList<T>> Permutations<T>(IList<T> list) { List<IList<T>> perms = new List<IList<T>>(); …
Jump to PostJust FYI Combination Generation is right here
All 8 Replies
Mitja Bonca
557
Nearly a Posting Maven
Momerath
1,327
Nearly a Senior Poster
Featured Poster
Dasharnb777
0
Newbie Poster
Mitja Bonca
557
Nearly a Posting Maven
Dasharnb777
0
Newbie Poster
Mitja Bonca
557
Nearly a Posting Maven
Dasharnb777
0
Newbie Poster
Momerath
1,327
Nearly a Senior Poster
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.