Example 2 . Now majority rule enables the decoding function D to detect and correct the error. If exactly one error has occurred, then it will be detected and corrected . Suppose we are given a set of possible code words C , known both to sender and receiver. Assume decoding by majority rule as before.
Repetition codes work well.
However, their rates, in the technical sense, are bad. Hamming codes also work well. And their rates are optimal. Let us consider Tanenbaum's Exercise 14 on page 115 again, where we are asked to assume even parity and then to find a Hamming encoding for each of the four-bit strings on the left in the table below.