Coding question!

W

Warrio

Hello! This is only a question about coding,



how is it possible to calculate the possible combinations between a series
of members?

In addition the total number of the members of each series should not exceed
a fixed number.



For instance:

-the members are: (1; 2; 7; 9)

-each series must contain 3 members (can be 2, 3, 14 or any
number)



The result would be:

Series1: 1; 2; 7

Series2: 1; 2; 9

Series3: 2; 7; 9



I tried with 3 loops with a collection structure, but I differentiate my
head from feet anymore.



Thanks for any suggestion!
 
J

John Nurick

Hi Warrio,

Search (using Google or another engine) for

vb generate unordered combinations algorithm OR code

or similar and you'll find some examples.
 
J

John Nurick

That's easy: put the members into an array(0..k-1) and use the numbers
generated by the n of k code to select elements from the array.

Thanks John!
and that's what I found in msdn articles
a code in c, that generates combination of n members on series of k elements
http://msdn.microsoft.com/library/d...ry/en-us/dv_vstechart/html/mth_lexicograp.asp

it answers the question below except that this code starts the combinations
from 0 to n-1, I will have to modify it in order to put any members the user
wants

Best regards
 
W

Warrio

Again thanks for all the great job you're doing!


John Nurick said:
That's easy: put the members into an array(0..k-1) and use the numbers
generated by the n of k code to select elements from the array.
 
Top