Will your school radio clip and poster fit under a 4 MB upload limit?
You’re uploading a poster and a sound clip for your school radio show, but the form only accepts four megabytes in total. Can you make both files fit without changing what people see or hear?
The table gives you the file sizes. The sound clip takes two megabytes, and the poster takes three. Add them to get five megabytes. The upload limit is four megabytes, so you need to save at least one megabyte.
Ignore any extra data the connection sends. At eight megabits per second, divide twenty-four megabits by eight to get three seconds for the original poster. The smaller version takes two seconds because it uses sixteen megabits. Representing data with fewer bits is called compression.
A compressed clip is twelve megabits. Your connection sends four megabits each second. Ignoring anything extra the connection has to send, how long will the clip take? Pick an answer.
Lossless compression gives you the exact original. Lossy compression gives you an approximation. Choose lossless if every pixel of the poster’s small print must stay the same. Lossy compression can suit a radio preview if the speech stays clear. The mistake is thinking all compression discards information. Only lossy compression does.
Read from left to right. Six A’s make one run, three B’s make the next, and the final A starts a new run. Run length encoding stores each run as a frequency and data pair. Repeat each character the stated number of times to recover the exact message.
This Huffman tree gives the most frequent letter, A, the shortest code. Start at the top for each letter. Zero reaches A. If you take one first, keep going: zero next reaches B, and one next reaches C. So B is one zero and C is one one.
Write zero for each A, one zero for each B, then one one for C. Join the codes. Four single bits and three pairs of bits make ten bits. With seven bits per character, ASCII would take forty-nine bits. Subtract ten to save thirty-nine bits for the message alone.
Use the same Huffman codes on a shorter message: three A’s, then B, then C. Compare the encoded message with seven-bit ASCII. Count only the message bits, ignoring any bits needed to store the tree. How many bits do you save? Pick an answer.
An exam question might ask you to calculate the combined file size after compression. Divide sixteen megabits by eight to get two megabytes for the poster. Add the unchanged two-megabyte clip. The total is four megabytes, exactly the upload limit, so both files fit with no space left.