File compression

    1. reduce space(encoding) => reduce computing or communication time
    2. Impossible to compress every files.

.Run length
     AAAABBBAABBBBBCDDDQM

.alphabets only =>4A3BAA5BC3DQM

.Mixed       =>QDABBBAAQEBCDDDQbM
                         ^ ^4                                 ||
             Escape character                          Q
 
.Binary file'0' & '1'
                                                                                                           51 bits => No EOL
000000000000000000000000000011111111111111000000000    28  14  9
000000000000000000000000001111111111111111110000000    26  18  7
000000000000000000000001111111111111111111111110000    23  24  4
000000000000000000000011111111111111111111111111000    22  26  3
000000000000000000001111111111111111111111111111110    20  30  1
000000000000000000011111110000000000000000001111111    19  7  18  7
000000000000000000011111000000000000000000000011111    19  5  22  5
000000000000000000011100000000000000000000000000111    19  3  26  3
000000000000000000011100000000000000000000000000111    19  3  26  3
000000000000000000011100000000000000000000000000111    19  3  26  3
000000000000000000011100000000000000000000000000111    19  3  26  3
000000000000000000001111000000000000000000000001110    20  4  23  3  1
000000000000000000000011100000000000000000000111000    22  3  20  3  3
011111111111111111111111111111111111111111111111111    1  50
011111111111111111111111111111111111111111111111111    1  50
011111111111111111111111111111111111111111111111111    1  50
011111111111111111111111111111111111111111111111111    1  50
011111111111111111111111111111111111111111111111111    1  50
011000000000000000000000000000000000000000000000011    1  2  46  2
 
.Huffman Coding
    .encode frequent character with shorter string

                                                                                                                                           count [30] = 21
                                                                                                                                           dad [18] = -30
                                                                                                                                           dad [34] = 30

           I
          ¡ü
Code [9] = 1 = '001'
len [9] = 3

    .Prefix code ¡Gno sequence is a prefix of another
    .Optimun prefix code ¡Gshortest encoded string

    Example of non-preprefix code
        A : 1 0
        B : 0 1 1
        C : 0 1 1 1 0

        0 1 1 1 0 = B A ?
                          C     ?