Skip to main content
1 of 4
lchen
  • 367
  • 4
  • 12

A variant of Huffman code

Given an alphabet of $n$ symbols with probabilities $p_i$ for symbol $i$, we need to encode the symbols (in a prefix-free way) to minimize the following formula. $$a(1-a)L,$$ where $L$ is the average code length for a symbol, $a$ is the percentage of bit $1$ in a large number of coded symbols. Apparently Huffman code is not optimal in this particular context. Is there a way to find the optimal code?

lchen
  • 367
  • 4
  • 12