Text Compression
In this lesson, you will understand the details of Huffman Encoding with the help of an exercise on text compression.
We'll cover the following...
The Huffman Encoding algorithm can be used to find provably optimal length prefix free codes to compress data that involves redundancies. For simplicity, the algorithm can be divided into five parts:
-
First, we create a
that records the frequency of each character in the input text in line 20 inside the functiondictionary A Python dictionary stores unordered key-value pairs. createFrequencyDictionary
. This dictionary is calledfrequencyDictionary
. We check for every unique character and add its count in thefrequencyDictionary
against the ...