Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating combinations that have no more one intersecting element

Tags:

I am looking to create a special type of combination in which no two sets have more than one intersecting element. Let me explain with an example:

Let us say we have 9 letter set that contains A, B, C, D, E, F, G, H, and I

If you create the standard non-repeating combinations of three letters you will have 9C3 sets. These will contain sets like ABC, ABD, BCD, etc. I am looking to create sets that have at the most only 1 common letter. So in this example, we will get following sets:

ABC, ADG, AEI, AFH, BEH, BFG, BDI, CFI, CDH, CEG, DEF, and GHI - note that if you take any two sets there are no more than 1 repeating letter.

What would be a good way to generate such sets? It should be scalable solution so that I can do it for a set of 1000 letters, with sub set size of 4.

Any help is highly appreciated.

Thanks


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!