theory - Valid Huffman Codes? -
i'm trying solve huffman coding problem, i'm not sure understand topic completely. trying figure out if following valid huffman code:
a: 0 b: 01 c: 11 d: 110 e: 111
what i'm thinking is not valid, because a, or 1, infringe on b, or 01. i'm not positive though. enlighten me on this?
edit: i'm sorry meant type 0 , not 1.
no. huffman code prefix code, means no code can prefix of other code. in example, prefix of b, , c prefix of both d , e.
a valid prefix code be:
a: 0 b: 10 c: 11
that's far can go codes of length 1, 2, , 2. other codes prefix of those. not possible have prefix code lengths 1, 2, 2, 3, , 3.
this valid prefix code 5 symbols:
a: 0 b: 10 c: 110 d: 1110 e: 1111
as this:
a: 00 b: 01 c: 10 d: 110 e: 111
Comments
Post a Comment