346,806 views
22 votes
22 votes
Sue says that she ran the Huffman coding algorithm for the four characters, A, C, G, and T, and it gave her the code words, 0, 10, 101, 110, respectively. Give examples of four frequencies for these characters that could have resulted in these code words or argue why these code words could not possibly have been output by the Huffman coding algorithm.

User Yusubov
by
3.1k points

1 Answer

15 votes
15 votes

Answer:

10 is a prefix of 101, so in a stream you couldn't tell these a part. So this cannot be a valid Huffman code.

User Daniel Farrell
by
3.0k points