Member-only story
Data Compression (Part 3)
Huffman Encoding
Please give a read to Part 2 here
Now, let’s understand a standard compression technique known as “Huffman encoding” which further reduces the length of our text.
While reducing length, we kept one thing in mind i.e “No binary is a prefix of another”.
And for this, we gave all binary an equal length since a binary can be a prefix of another only if its length is shorter than that of another one.
But what if it is possible to assign binary formats without giving equal length to all and still no binary format is a prefix of another ??? 🤔
If this is possible, the binary format of our text will further be reduced.
Huffman comes for rescue here.
Lets understand a basic thing first before going deep into this:
We have two nodes in this tree and we allocate 0 on the left edge and 1 on the right edge.
So node “A” can be given binary 0









