Older
labs / tiddlers / content / labs / lab01 / _Labs_01_Decoding and Encoding Data Sequences.md

Recall in lectures that we presented a Huffman tree that was constructed by examining the frequency of characters on Wikipedia: {{/Labs/01/Images/fig3.svg}} The corresponding Huffman coding for this tree is:
{{/Labs/01/Images/HuffmanTreeCode}}

Using this coding, we can decode the sequence

1100010100010100110100001100111001111011100111

as: 11000 = C (remaining bits: 10100010100110100001100111001111011100111)

1010 = O (remaining bits: 0010100110100001100111001111011100111)

001010 = M (remaining bits: 0110100001100111001111011100111)

011010 = P (remaining bits: 0001100111001111011100111)

000 = [space] (remaining bits: 1100111001111011100111)

1100111 = 1 (remaining bits: 001111011100111)

00111101 = 0 (remaining bits: 1100111)

1100111 = 1 (no remaining bits, end of sequence)

Resulting in the string 'COMP 101'.

### Exercise

Use this Huffman coding to decode the following bits: 11010011001001001100110101001