2
$\begingroup$

I am a bit confused by the difference between the two. Can someone clarify the difference between the two?

$\endgroup$
2
$\begingroup$

A fixed-to-variable length code is a code that takes a string in $\cal X^*$, partitions it into chunks of fixed length $n$, and replaces each chunk $w$ by some codeword $C(w)$ whose length isn't fixed. The classical example is prefix codes. A prefix code such as Huffman's code replaces each symbol $\sigma \in \cal X$ by a codeword $C(\sigma)$, with the aim of minimizing $\mathbb{E}[|C(\sigma)|]$ with respect to some distribution on $\cal X$. We can obtain a better rate by applying Huffman coding on $k$-tuples of inputs. This corresponds to a fixed-to-variable length code that encodes each word $w$ of fixed length $k$ by a codeword $C(k)$.

A variable-to-fixed length code is a code that takes a string in $\cal X^*$, breaks it into pieces of variable length, and replaces each piece into a word of fixed length. The classical example is Lempel-Ziv encoding with fixed dictionary size. Lempel-Ziv breaks its input into chunks, where each chunk extends a word in the dictionary by one symbol. Each chunk is then encoded as an index into the dictionary together with the new symbol. The encoding thus has fixed length, but the chunks vary in length.

$\endgroup$
  • $\begingroup$ Thanks, that makes a lot of sense now. In a way, I will try to remember as follows: Fixed to variable, takes a fixed "chunk", and changes it a code word with variable length. Variable to fixed takes a variable "chunk", and changes it to a fixed code word with a fixed length. $\endgroup$ – AspiringMat Nov 26 '17 at 15:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.