Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Measurement Studio support for combinations and permutations?

Does MS provide anything that will generate combinations of a collection of items?

 

E.g.  generate all combinations of a set of N items taken K at a time  (AKA an "N Choose K algorithm").

 

If we have a list of 5  integers  { 1, 2, 3, 4, 5 } and we want   5 choose 2 we get:

 

{1,2}

(1,3}

{1,4}

{1,5}

{2,3}

{2,4}

{2,5}

{3,4}

{3,5}

{4,5}

 

Thanks.

0 Kudos
Message 1 of 3
(5,250 Views)

Hey menchar,

 

I did not find anything initial research. The function would have to be pretty robust to handle the different data types that you would pass into it. Have you found anything or tried anything else? What type data is your list? Again, from what I have found, it does not look like there is anything in measurement studio that natively makes combinations or permutations in Measurement Studio. 

 

Regards,

 

-KP

Kurt P
Automated Test Software R&D
0 Kudos
Message 2 of 3
(5,221 Views)

Thanks for looking, didn't think there was.

 

Combinations and permutations sometimes found in probability and statistics libraries.

 

In my case the elements are unsigned ints, using it in image processing.

 

I needed N choose 2 so in this case it's easy to hack it.  It's more of a challenge to do it for N choose K.    I'm sure Knuth has something for it, but I didn't want to write it from scratch if I didn't have to.  There are C# classes available to do it (they call it combinatorics) but even though they are "free" they are licensed and not really suitable for inclusion in a commercial project.  You can do it with Linq in C# too.

 

Thanks for looking.

0 Kudos
Message 3 of 3
(5,217 Views)