The Hamming distance between two vectors is the number of positions in which the vectors differ. For example, the Hamming distance between 100 and 010 is 2. A binary Gray code is a subset sequence in which the Hamming distance between any pair of consecutive vectors(called codewords) is 1. The three-element subset sequence 000, 100, 110, 010, 011, 111, 101,001 is a Gray code. A Gray code may be compactly represented by giving the sequence of positions in which the vectors change. For the three-element Gray code, the position change sequence is 1, 2, 1, 3, 1, 2, 1.
g(n) is the position change sequence for a Gray code with n elements. g(n) can be obtained by the following recursive definition:
g(n) = 1 for n = 1;
g(n) = g(n - 1) , n, g(n - 1) for n > 1
what dose it mean g(n) = g(n - 1) , n, g(n - 1) for n > 1
if we write like this:
If (n = = 1 )
Return g(n)=1;
Else if (n>1)
Return g(n-1)
But what is n and the second g(n - 1)