Skip to main content
4 of 4
added 160 characters in body
kodlu
  • 10.4k
  • 2
  • 36
  • 55

A variant of Huffman code

Given an alphabet of $n$ symbolswith probabilities $p_i$ for symbol $i$, we need to encode the symbols (in a prefix-free way) to binary codewords $c(i)$ with length $\ell(c(i))$ to minimize the expression $$a(1-a)L,$$ where $$L=n^{-1}\sum_{i=1}^n \ell(c(i))$$ is the average codeword length per symbol, and $a$ is the relative frequency of $1$s in all codewords, i.e., $$ a=\frac{\sum_{i=1}^n H(c(i))}{\sum_{i=1}^n \ell(c(i))} $$

Apparently Huffman code is not optimal in this particular context. Is there a way to find the optimal code?

lchen
  • 367
  • 4
  • 12