BinaryCode.md (830B)
1 # Binary Code 2 3 Ch 6 4 5 **Definition:** A binary code for S is a function c from S -> {0,1} * . 6 7 Basically, this is the function to encode elements of S to binary. 8 9 ### Proper 10 11 A proper binary code is a binary code such that there are not any possible combinations of codes that can be confused with each other. 12 13 Example of improper: 14 15 S = {'A', 'B', 'C'} 16 17 c : S -> {0,1}\* 18 19 c('A') = 0 20 21 c('B') = 01 22 23 c('C') = 10 24 25 The problem here is that we don't know if 010 is BA or CA. This is because the prefix of B is A. 26 27 It is sufficient to ensure all codewords are not prefixes for other codewords. 28 29 #### Prefix Property 30 31 **Definition:** c : S -> {0,1}\* be a binary code. We say c has the prefix property if no codeword is a prefix of any other codeword. 32 33 $\forall x,y \in S, x \neq y$ then there are no strings r such that $c(x) = c(y) + r$