Question

I can't think of any counterexample but I can't find any such statement on the internet or my textbook either. I know that for each uniquely decodable code, there exists a prefix code with the same average length.

Was it helpful?

Solution

You can prove by induction on the length of the encoding that any string is uniquely decodable.

Let $s=s_1...s_n$ be some string encoded with a prefix free code. Since our code is prefix free, there exists a unique prefix of $s$, $s_1...s_j$ which is a code word. $s_{j+1}...s_n$ is also a valid encoding (we removed a single codeword from a concatenation of codewords), so by our inductive hypothesis, $s_{j+1}...s_n$ is uniquely decodable, which completes the proof.

Licensed under: CC-BY-SA with attribution
Not affiliated with cs.stackexchange
scroll top