F05 · Topic 2.2
Compression tradeoff
1. Predict first
A 20-byte message needs 12 payload bytes plus 10 dictionary bytes. Is it smaller? Give the exact difference.
Change it · step through · explain
Change an input, predict what will happen, then advance one step. Read why the state changes, reset and experiment. This fixed teaching model does not save progress or award XP.
Ready · Make a prediction
- Input 120Waiting
- Input 212Waiting
- Input 310Waiting
Ready to experiment
Why: Predict the first change, then advance one step.
Try this: Make payload + dictionary equal the original, then change it by one byte.
2. Build your procedure
Specify a reversible dictionary for a repeated message, encode and decode it, and compare original bytes with payload plus dictionary. Then identify a different use where a stated loss is acceptable.
Use AP CSP pseudocode, a language you know, or precise plain language. Your code is not executed here. Use the classroom assignment to save your response.
3. Check boundaries
| Input | Expected | Why this case |
|---|---|---|
| Original 20,payload 12,dictionary 10 | 22 bytes;2 bytes larger | Overhead counts. |
| Original 40,payload 12,dictionary 10 | 22 bytes;18 bytes saved | The same overhead can pay off on a more repetitive message. |
| Original 22,payload 12,dictionary 10 | Equal size | Break-even is not a reduction. |
4. Explain and reflect
Does a compressed file automatically protect its contents from an observer?
Model limits: A size-accounting model. It does not run a general codec or guarantee a compression ratio for arbitrary files.