theDeveloper
theDeveloper

Reputation: 209

Getting all permutations of a word or number

Using LINQ or the old-fashioned approach, how can I get all permutations of a word/number (without using an external API)?

Eg ab = ab, ba, abc = acb, bac, etc

Is this a specific computer science problem like image recognition, etc?

Upvotes: 4

Views: 1106

Answers (1)

jason
jason

Reputation: 241789

There is a fantastic MSDN article on this very subject that should help you get started. This is a very well-studied computer science problem. For additional reference, see fascicles of The Art of Computer Programming Volume 4. In particular, check out Pre-fascicle 2B which exactly covers the problem of generating all permutations.

Upvotes: 5

Related Questions