Compression quiz



Suppose that you have a N-byte input stream consisting of N 7-bit ASCII characters. Approximately what compression ratio does the following code-fragment achieve?
   while (!BinaryStdIn.isEmpty()) {
       char c = BinaryStdIn.readChar(8);
       BinaryStdOut.write(c, 7);
   }
   BinaryStdOut.close();

1/8
7/8
1
8/7

Consider the following trie representation of a prefix-free code. Which string is encoded by the compressed bit string 100101000111011?

PEED
PESEDY
SPED
SPEEDY

What is the LZW compression of ABAB?

41 42 41 42 80
41 42 81 80
81 81 80