Why are inverted prefix codes uniquely decodable?

74 Views Asked by At

My professor stated that inverted prefix codes are always uniquely decodable but did not state the reason why?

Could anyone please explain to me why this would be the case?

1

There are 1 best solutions below

0
On

Lemma: if $\mathcal{C}$ is UD (uniquely decodable code) then $\mathcal{C'}$ (inverted code) is also UD.

Proof (sketch). Let $A,B,C \cdots $ be the codewords of $\mathcal{C}$, and let $A',B',C' \cdots $ be the codewords of $\mathcal{C'}$. Suppose that $\mathcal{C'}$ is not UD. Then there must exist some pair of sequences (of inverted codewords) that produce the same concatenation, say for example $(A',B',A',D')=(E',C',A')$. But then, inverting, we would have $(D,A,B,A)=(A,C,E)$, and hence $\mathcal{C}$ would not be UD either.

Now, a prefix code is UD. Hence applying the lemma, the inverted prefix code is UD.