The document discusses Huffman tree coding, which is a variable-length encoding technique that assigns codewords of different lengths to symbols based on their frequency of occurrence. It explains how to create a Huffman tree from symbol frequencies, derive the Huffman codes, and use the codes to encode and decode messages. An example is provided where the frequencies of letters in an alphabet are used to generate a Huffman tree and codes, and a message is encoded and decoded to demonstrate the process.
The Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docx
Huffman tree coding
1. Huffman Tree Coding
Greedy Technique
1
Dr. P. Subathra
Prof/ IT
KAMARAJ College of Engg. & Tech
(AUTONOMOUS)
Madurai
2. Huffman Tree Coding
• Encoding
– In computer technology, encoding is the process of putting a
sequence of characters into a special format for transmission
or storage purposes.
• Code Word
– The special format that represents each character is called as
the code word
• Fixed Length Encoding
– fixed-length encoding that assigns to each symbol a bit string
of the same length m
– Eg. ASCII codes
• Variable Length Encoding
– Variable-length encoding, which assigns codewords of
different lengths to different symbols
2
3. Huffman Tree Coding
• Encoding
– In computer technology, encoding is the process of putting a
sequence of characters into a special format for transmission
or storage purposes.
• Code Word
– The special format that represents each character is called as
the code word
• Fixed Length Encoding
– fixed-length encoding that assigns to each symbol a bit string
of the same length m
– Eg. ASCII codes
• Variable Length Encoding
– Variable-length encoding, which assigns codewords of
different lengths to different symbols
3
4. Huffman Tree Coding
• Encoding
– In computer technology, encoding is the process of putting a
sequence of characters into a special format for transmission
or storage purposes.
• Code Word
– The special format that represents each character is called as
the code word
• Fixed Length Encoding
– fixed-length encoding that assigns to each symbol a bit string
of the same length m
– Eg. ASCII codes
• Variable Length Encoding
– Variable-length encoding, which assigns codewords of
different lengths to different symbols
4
7. Huffman Tree Coding
• Encoding
– In computer technology, encoding is the process of putting a
sequence of characters into a special format for transmission
or storage purposes.
• Code Word
– The special format that represents each character is called as
the code word
• Fixed Length Encoding
– fixed-length encoding that assigns to each symbol a bit string
of the same length m
– Eg. ASCII codes
• Variable Length Encoding
– Variable-length encoding, which assigns codewords of
different lengths to different symbols
7
8. Huffman Tree Coding
• Variable-length encoding assigns codewords of different lengths to
different symbols
• Eg.
E 1
A 10
P 101
Q 1010
• How to decode: 110101 ?
• How can we tell how many bits of an encoded text represent the
first ?
8
9. Huffman Tree Coding
• We can limit ourselves to the so-called prefix-free (or simply
prefix) codes.
• In a prefix code, no codeword is a prefix of a codeword of
another symbol.
• Eg.
E 1
A 01
P 100
Q 101
• How to decode: 10101101 ?
• 1 01 01 101 E A A Q
9
10. Huffman Tree Coding
Consider the five-symbol alphabet { A, B, C, D, _ }
with the following occurrence frequencies in a text
made up of these symbols:
Create a Huffman Tree and Generate the Huffman
Code.
10