for x, y ∈ {0, 1}^n (i.e., they are binary vectors of size n), then recall that dist(x, y) denotes the Hamming distance between x and y.**A non-linear code of length n and minimum distance d is a subset C ⊆ {0, 1}^n such that dist(x, y) > d for all x, y ∈ C. Denote by A(n, d) the maximum number of n-tuples in length n non-linear code of minimum distance d. **
下面那个是hamming distance的代码(我自己根据定义写的,应该是正确的)
def HammingDist(a,b):
m = n = 0
while(n < len(a)):
if(a[n] != b[n]):
m += 1
n += 1
return m
```python
要求是用回溯算法(backtracking)计算 A(n, 4) for n ≤ 8.
主要是看不懂第二和第三句话。
希望能用python代码给予解答(或者提供思路),感谢!!