Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

What is the best possible compression ratio (i.e., the smallest ratio (# bits af

ID: 3761155 • Letter: W

Question

What is the best possible compression ratio (i.e., the smallest ratio (# bits after compression)/(#bits before compression)) you could expect to get for any message using the LRE109 compression algorithm? Give an example of a message that has this optimal compression ratio. (Hint: Consider a message that involves multiple occurrences of only a single letter.) What is the best possible compression ratio (i.e., the smallest ratio (# bits after compression)/(#bits before compression)) you could expect to get for any message using the LRE109 compression algorithm? Give an example of a message that has this optimal compression ratio. (Hint: Consider a message that involves multiple occurrences of only a single letter.) What is the best possible compression ratio (i.e., the smallest ratio (# bits after compression)/(#bits before compression)) you could expect to get for any message using the LRE109 compression algorithm? Give an example of a message that has this optimal compression ratio. (Hint: Consider a message that involves multiple occurrences of only a single letter.)

Explanation / Answer

Answer :

What is the best possible compression ratio you could expect to get for any message using the LRE109 compression algorithm?

After run-length encoding, the 15-byte string would require only eight bytes of data to represent the string, as opposed to the original 15 bytes. In this case, RLE yields a compression ratio of almost 2 to 1.

Give an example of a message that has this optimal compression ratio ?

Encoding the single character at the end as two bytes did not noticeably hurt our compression ratio because there were so many long character runs in the rest of the data and also observe how RLE encoding doubles the size of the 14-character string.

Utmprsqzntwlfb----->After Encoding Becomes as--->1U1t1m1p1r1s1q1z1n1t1w1l1f1b