3

I have a list of objects. I need all possible permutations of those objects.

In C++, there's std::next_permutation(). I have been trying to find something in the .NET Framework, but came up dry.

What am I missing?

Redwood
  • 66,744
  • 41
  • 126
  • 187
sbi
  • 219,715
  • 46
  • 258
  • 445

2 Answers2

4

I don't think it's built in to the framework but there's a good article on CodeProject with some samples

http://www.codeproject.com/KB/recipes/Combinatorics.aspx

Fiacc
  • 1,324
  • 1
  • 15
  • 24
  • I was just about to post the same article. – spinon Jun 30 '10 at 18:37
  • I'm not after a way to implement this. I thought it would be in the Framework. (That would be the very first time I come across something which is available in the C++ std lib but not in the .NET Framework.) – sbi Jun 30 '10 at 18:39
1

I also think that there is no permutations() function included in the .NET Framework. But you could always go and implement it yourself...

...in that case you might find this post useful:

Fast permutation -> number -> permutation mapping algorithms

Community
  • 1
  • 1
evermean
  • 1,255
  • 21
  • 49