Huffman Coding
Huffman coding is a lossless data compression algorithm based on the frequency of occurrence of a data item. Codes of different lengths are assigned to characters based on the frequency of occurrence. Smaller codes are assigned to characters that have the highest occurrence.
Lets look at an example. Let’s encode the word LEMMONS
First, create a table showing the frequency. Order the table by frequency from lowest to highest.
Now construct a Huffman tree. Create leaves for each of your characters using the table above.
Take the first ...
Get Essential Computer Hardware now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.