In
coding theory, a
balanced code is a
binary forward error correction code for which each codeword contains an equal number of zero and one bits. Balanced codes have been introduced by
Donald Knuth; they are a subset of so-called unordered codes, which are codes having the property that the positions of ones in a codeword are never a subset of the positions of the ones in another codeword. Like all unordered codes, balanced codes are suitable for the detection of all
unidirectional errors in an encoded message. Balanced codes allow for particularly efficient decoding, which can be carried out in parallel. Some of the more notable uses of balanced-weight codes include
biphase mark code uses a 1 of 2 code;
6b/8b encoding uses a 4 of 8 code; the
Hadamard code is a 2^{k-1} of 2^k code (except for the zero codeword), the
three-of-six code; etc. The 3-wire lane encoding used in
MIPI C-PHY can be considered a generalization of constant-weight code to ternary -- each wire transmits a
ternary signal, and at any one instant one of the 3 wires is transmitting a low, one is transmitting a middle, and one is transmitting a high signal. ==
m-of-
n codes==