0%

Problem 219


Problem 219


Skew-cost coding

Let A and B be bit strings (sequences of 0’s and 1’s).
If A is equal to the leftmost length(A) bits of B, then A is said to be a prefix of B.
For example, 00110 is a prefix of 001101001, but not of 00111 or 100110.

A prefix-free code of size n is a collection of n distinct bit strings such that no string is a prefix of any other. For example, this is a prefix-free code of size 6:

0000, 0001, 001, 01, 10, 11

Now suppose that it costs one penny to transmit a ‘0’ bit, but four pence to transmit a ‘1’.
Then the total cost of the prefix-free code shown above is 35 pence, which happens to be the cheapest possible for the skewed pricing scheme in question.
In short, we write Cost(6) = 35.

What is Cost(109) ?


成本倾斜编码

AB均为比特串(由0和1组成的序列)。
如果在B的最端取和A的长度相等的比特位,所构成的比特串恰好等于A,则称AB前缀
举例来说,00110是001101001的前缀,但不是00111或100110的前缀。

n阶无前缀编码是指n个不同的比特串,其中任意一个都不是另一个的前缀。例如,6阶无前缀编码的其中一种是:

0000, 0001, 001, 01, 10, 11

现在假设传输比特位“0”的成本是一个便士,而传输比特位“1”的成本是4个便士。
那么,上述无前缀编码的总成本是35便士,恰好是这个成本倾斜编码问题最便宜的一种可能。
我们将其简记为Cost(6) = 35。

Cost(109)是多少?