Decoding Hamming Code
All in all, there are 16 possible codewords:
How does decoding work? Again, by some kind of majority vote. Given a string of 7 bits, it can either be one of the 16 codewords, and then we know what the original string was, or it can be a corrupted codeword. In that last case, we simply find the codeword in the list of all possible codewords that differs least from our string.
For instance, if the string is 1010110, then the most similar codeword is 1000110 (since it differs in only one entry), and so the decoded string is given by the first 4 bits of that codeword, namely 1000.Let's try a few examples. After typing in your answer, press return to see if you are correct: