0
$\begingroup$

Two main disadvantages of Huffman encoding is that it makes two passes over data:

  1. First pass: Find out sequences frequencies $f(\cdot)$ of letters $c \in C$ in the document $D$. Then constructing Huffman optimal tree before transmitting the tree to the receiver.
  2. Second pass: encode and transmit the letters themselves based on tree structure.

Problem: Why we don't just transmit Huffman Tree over network to the receiver please? Why we need the second pass?

$\endgroup$
1
  • 1
    $\begingroup$ Take "War and Peace". Create the Huffmann tree and send it to me, and that's it. What am I going to do with that tree? $\endgroup$
    – gnasher729
    Oct 12 at 23:15
2
$\begingroup$

The second pass corresponds to the message you want to transmit. If you don't do it, the receiver will only receive the tree, and have information on the frequency of letters in your message, but not the message itself.

$\endgroup$
2
  • $\begingroup$ Thank you. You mean the second pass is the raw bits of the message that is to be decoded by the tree from the first pass please? $\endgroup$
    – Avra
    Oct 12 at 20:12
  • 1
    $\begingroup$ Yes, that's it. $\endgroup$
    – Nathaniel
    Oct 12 at 21:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.