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?

  • 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
    Commented Oct 12, 2021 at 23:15

1 Answer 1


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.

  • $\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$
    – Avv
    Commented Oct 12, 2021 at 20:12
  • 1
    $\begingroup$ Yes, that's it. $\endgroup$
    – Nathaniel
    Commented Oct 12, 2021 at 21:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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