2

Is there an efficient algorithm to find a group of sets, where all the sets each have the same number of elements and differ from each other by exactly one element, such that the number of unique elements across all sets is minimized?

This question came from wondering how the makers of the card game Spot It! came up with a deck of cards that each differ from each other by only one picture. I posed this question on Code Golf, with some additional detail, and someone suggested I ask the math community.

2 Answers2

1

To summarise the answer I gave in the original question:

This can be rephrased as

What is the maximal size of binary code of length $N$, constant weight $n$ and exact pairwise Hamming distance $2(n-1)$?

This is bounded by the coding theory function $A(n, d, w)$ giving the maximal size of binary codes of length $N$, constant weight $w$, and minimal Hamming distance $d$: specifically, it's bounded by $A(N, 2(n-1), n)$.

It's fairly easy to prove that there's a further bound of $\max(n^2 - n + 1, \lfloor\frac{N-1}{n-1}\rfloor)$, that for $N \ge n^2-n+1$ this bound is tight, and that there is an efficient algorithm for finding such a code; I hypothesise that for $N \lt n^2 - n + 1$ the coding theory bound is tight, but I haven't proved it.

Peter Taylor
  • 13,425
0

Assuming that you want all possible $n^d$ ordered lists (i.e. sequences) with $d$ elements, each drawn from the collection of $n$ pictures, you can use an $n$-ary Gray code.

Sammy Black
  • 25,273