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."
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.
| Members | Q5 answers in the order they came in |
|---|---|
| M01 to M10 | S S S S S S S S S S |
| M11 to M20 | S S S S P P S S S S |
| M21 to M30 | P P P S S S S S S P |
| M31 to M40 | S 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.
Wren has six visit times from the door log, with no names. Comet rounds each one to the nearest hour.
| Original time | Rounded to the hour |
|---|---|
| 10:05 | 10:00 |
| 10:40 | 11:00 |
| 11:15 | 11:00 |
| 11:50 | 12:00 |
| 2:20 | 2:00 |
| 2:55 | 3:00 |
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 finding | True 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. | ? |
Great lab work, data analyst. Tomorrow you will decide where the data sheet should live.