views:

204

answers:

1

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?

Thanks

+4  A: 

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.

Jason