← Back to course
3/6
Week 05 · Storing Data

Wednesday

Count Lab: Shrink the sheet
// From answers to codes to bits
⏱ about 20 min

Wednesday: Count Lab: Shrink the Sheet

Keeper Ines holds up the Q5 column. "Forty letters, S for screen and P for paper form. It fills a whole strip of the page."

Comet squints at it. "Most of them are S. S, S, S, S, again and again."

Wren nods. "What do you notice about how they repeat?"

"They come in long runs," Comet says. "Fourteen S in a row at the start!"

Nova hovers above the strip. "Would you like a hint?" she asks. "Could you write how long each run is, instead of every letter?"

Comet grins. "Fourteen S. Let's try it."

Wren holds up a second sheet of visit times. "And this one might shrink a different way."

Your mission

Compression reduces the number of bits used to store data. Fewer bits does not always mean less information.

You will shrink two parts of the sheet in two ways. Then you will try to rebuild the original from each.

  • Paper and a pencil
  • The Q5 strip and the visit times below
MembersQ5 answers in the order they came in
M01 to M10S S S S S S S S S S
M11 to M20S S S S P P S S S S
M21 to M30P P P S S S S S S P
M31 to M40S S S S P P P S S S

This is made-up data from the Commons Count story. S means the screen and P means a paper form.

PREDICT FIRST
  • Read the question.
  • Tap your answer.
Will writing the length of each run make the Q5 strip shorter or longer?
  1. Start at M01. Count how many S letters come before the first P.
  2. Write the count and the letter, like 14S.
  3. Count the next run of P letters and write it, like 2P.
  4. Keep going to M40, writing one group for each run.
  5. Count your groups.
  6. Rebuild the strip from your groups alone, then compare it with the original.
CHECK THE RUN-LENGTH CODE
  • Read the question.
  • Tap your answer.
Your code should be 14S 2P 4S 3P 6S 1P 4S 3P 3S. How many groups is that?
Add the S runs: 14 plus 4 plus 6 plus 4 plus 3. What do you get?
Can you rebuild every letter of the original strip from the code?

A second column: rounding

Wren has six visit times from the door log, with no names. Comet rounds each one to the nearest hour.

Original timeRounded to the hour
10:0510:00
10:4011:00
11:1511:00
11:5012:00
2:202:00
2:553:00
CAN YOU REBUILD IT?
  • Read the question.
  • Tap your answer.
A rounded time says 11:00. Which original time was it?
What kind of compression is rounding the times?

When does it help?

Lossless compression lets you rebuild the original exactly. Lossy compression rebuilds only an approximation, but it usually shrinks data more.

Choose lossless when quality matters most. Choose lossy when size or speed matters most.

How much data shrink depends on how much they repeat and on the method used.

Try run-length on Q2 for M01 to M06: E A E W E A. Every run is 1 long, so the code 1E 1A 1E 1W 1E 1A is longer than the original!

Lab findingTrue or false?
Run-length coding the Q5 strip is lossless.?
Rounding times to the hour is lossy.?
Run-length coding shrinks every column, even one with no repeats.?
For the council's exact totals, lossless is the better choice.?
WHY THIS EXERCISEKnowing which compression to pick protects the data you cannot afford to lose.
On paper, write the run-length code for the Q5 strip, then rebuild the strip underneath it from the code alone.

Great lab work, data analyst. Tomorrow you will decide where the data sheet should live.

← Tuesday