Prefix code is defined as a code in which no codeword is a prefix of a any other codeword.

Example 1:

Assume the Huffman code:

A=11111, B=11110, C=1110, D=1101, E=1100, F=10, G=01, H=00

We have codeword 00 and no other codeword starts with 00. The five-bit codewords 11111 and 11110 start with 1111, which is not a codeword.

Example 2:

A=0, B=10, C=110, D=111

We have codeword 0 and no other codeword starts with 0. No codeword starts with 10. Therefore is a prefix code.

www.ece.nu