Gad
Gad

Reputation: 11

Encoding of String "a" using huffman algorithm

I tried calculating the Shannon entropy for a which is 0.. I am confused how huffman would encode and store this, as it's programmatically impossible to store string "a" with 0 bits in a computer system.

Upvotes: 1

Views: 64

Answers (1)

Mark Adler
Mark Adler

Reputation: 112414

Indeed the code for a single symbol would be zero bits. However you have to answer some other questions.

  1. How is the code itself transmitted to the receiver?
  2. How does the receiver know that it is done decoding?

To answer those questions, you'd need more bits in the stream for the receiver.

Upvotes: 1

Related Questions