Quote: Originally posted by RJOh on March 26, 2005
Quote: Originally posted by freehand on March 26, 2005
I want source code c++ for generation very fast possible random combinations for "n,k" but filtering...... such.... no more than 4 elements in common?
It sees this example:
C 10,6 = 210 FULL
But, filtering C 10,6 with maximum 4 elements in common = 18
01 02 03 04 05 06
01 02 03 04 07 08
01 02 03 04 09 10
01 02 03 05 07 09
01 02 03 05 08 10
01 02 03 06 07 10
01 02 03 06 08 09
01 02 04 05 07 10
01 02 04 05 08 09
01 02 04 06 07 09
01 02 04 06 08 10
01 02 05 06 07 08
01 02 05 06 09 10
01 02 07 08 09 10
03 04 05 06 07 08
03 04 05 06 09 10
03 04 07 08 09 10
05 06 07 08 09 10
The example you give is not randomly generated, it's a group of sequential combinations starting with the lowest and preceding to the next higher one. It's unlikely that a randomly generated list would start with 01 02 03 04 05 06 or even have that combination in the list. Regardless of how the combinations are generated, you need a routine that compare the newly generated combinations with the saved list and reject the combinations if it matches more than four numbers in any of those combinations in the list else add it to the list. The advantage of working with a sequential list is that you know when you have covered every possible combinations where with a randomly generated list, you would have to assume when no more combinations were added to the list every possible combination had been covered.
RJOh
Hi RJOh,
You are total certain.
For small amounts of numbers it is really better to filter all the combinations.
The same ideal is to have an option to use or random or full combinations.
But my main problem is compares the newly generated combinations with the saved list and reject the combinations if it matches lives than
four numbers in any of those combinations.
You can help me in this source code?
Regards,