Question: The basic intuition behind Huffman s algorithm, that frequent blocks should have short encodings and infrequent blocks should have long encodings, is also at work
The basic intuition behind Huffmans algorithm, that frequent blocks should have short encodings and infrequent blocks should have long encodings, is also at work in English, where typical words like I, you, is and, to from, and so on are short, and rarely used words like velociraptor are longer.
However, words like fire!, help!, and run! are short not because they are frequent, but perhaps because time is precious in situations where they are used.
To make things theoretical, suppose we have a file composed of m different words, with frequencies f fm Suppose also that for the i th word, the cost per bit of encoding is ci Thus, if we find a prefixfree code where the ith word has a codeword of length li then the total cost of the encoding will be
i fi ci li
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
