AP CSP Topic 2.2 Guided Notes - Data Compression
Big Idea 2: Data · Topic 2.2 · Guided Notes (Student)
Data Compression — Guided Notes
Fill these in during class or catch up here if you were absent. Print this page or work on paper — then check yourself with the CFUs on the Topic 2.2 page.
Print these notesTopic 2.2 lesson pageAll CSP topics
Today’s objectives
- Explain how compression reduces the number of bits stored or transmitted, and why the amount of reduction depends on both the redundancy in the data and the algorithm applied (LO DAT-1.D)
- Compare lossless and lossy compression algorithms and determine which is best in a particular context, using the reconstruction guarantee as the deciding line (LO DAT-1.D)
Bell ringer
Your phone plan charges 1¢ per character. You must text a friend this update: "Practice is cancelled today because the gym flooded. Coach says bring your uniform tomorrow because we play Riverside at four." (122 characters!)
Write two cheaper versions: (1) one your friend can expand back to the EXACT original, and (2) the cheapest that keeps the point. What did each cost you?
01. Why Compression Works
Key Vocabulary (LO DAT-1.D)
| Term | Definition (write it) |
|---|---|
| Data compression | |
| Redundancy | |
| Lossless compression | |
| Lossy compression |
Fewer Bits, Same Information
- Compression reduces the of transmitted or stored data.
- Fewer bits does not necessarily mean less information, because compression removes .
- The amount of size reduction depends on both .
Watch out — “Fewer Bits Means Less Information”
Myth: If a compressed file is 40% of its original size, then 60% of the information must have been thrown away — shrinking a file always shrinks its content.
Explain why this is wrong:
Stop and think
- Your bell-ringer version 1 used fewer characters than the original message, yet your friend could recover every word. Explain how this demonstrates that fewer bits does not necessarily mean less information.
- One song file and one spreadsheet are both compressed with the same lossless tool. The spreadsheet shrinks by 80%, the song file by 3%. Using the word redundancy, explain how the same algorithm can produce such different results.
- A classmate says a compressed file must be 'missing something.' In one sentence, state what lossless compression removes — and what it never removes.
Answer in complete sentences. Then check yourself with the matching CFUs on the Topic 2.2 page.
02. Lossless vs. Lossy: The Decision
Two Families, One Trade-off
Lossless
Lossy
- Lossless compression guarantees .
- Lossy compression only allows reconstruction of .
- Lossy compression usually shrinks data more than lossless because it .
AP TIP: Lossy usually shrinks data MORE than lossless — that extra reduction is exactly what you buy by giving up perfect reconstruction.
Choosing in Context
The exam names a situation; you name what matters most, then the winning family. Ask ONE question: must the original come back perfectly?
Complete the empty cells.
| Context | What matters most here | Best choice |
|---|---|---|
| A hospital archives X-ray scans that radiologists must re-read pixel-for-pixel | Quality / ability to reconstruct the original | |
| A video-chat app must keep a live call smooth on weak cellular data | ||
| A programmer backs up source code — one changed character breaks the program | Ability to reconstruct the original exactly | |
| A photo-sharing app shows phone-screen previews of millions of pictures | Minimizing data size and transmission time |
Deep Dive · Beyond the AP Exam
Deep Dive: Run-Length Encoding by Hand
The redundant original
The run-length version
- Run-length encoding replaces each run of identical values with .
- RLE is lossless because decoding it reproduces .
- On data with no runs, RLE can actually make the file .
Deep dive only — the AP exam asks you to CHOOSE between algorithms, never to trace how one works internally.
Stop and think
- An author emails a novel manuscript to an editor. A musician uploads a song preview for fans to stream on phones. For each, name the compression family that fits and the single context clue that decided it.
- A friend says: 'Lossless is guaranteed and lossy is only an approximation, so lossless is always the better choice.' Using the video-call row of the table, explain what the friend's rule ignores.
- Write the one question you should ask about ANY compression scenario on the exam — and state what each answer to that question tells you to choose.
Answer in complete sentences. Then check yourself with the matching CFUs on the Topic 2.2 page.
Common AP Traps
Three ways Topic 2.2 loses points on the exam — one minute now, real points in May.
“Lossless is always better” — in your own words:
Fewer bits ≠ less information — in your own words:
Reduction is not a fixed percentage — in your own words:
Data Compression, in One Slide
- Compression reduces the number of bits stored or transmitted — saving space and time.
- Fewer bits does not necessarily mean less information — lossless removes redundancy, not content.
- Size reduction depends on BOTH the redundancy in the data and the algorithm applied.
- Lossless guarantees complete reconstruction; lossy reconstructs only an approximation but usually shrinks more.
- The decision is contextual: quality/perfect reconstruction ⇒ lossless; minimum size/transmission time ⇒ lossy.
Exit check — I can…
- ☐ explain how compression reduces the bits stored or transmitted, and why reduction depends on redundancy and the algorithm (LO DAT-1.D)
- ☐ explain why fewer bits does not necessarily mean less information (LO DAT-1.D)
- ☐ tell lossless from lossy by the reconstruction guarantee (LO DAT-1.D)
- ☐ choose the best compression type for a given context and justify it (LO DAT-1.D)
Get in Touch
Whether you're a student, parent, or teacher — I'd love to hear from you.
Just want free AP CS resources?
Enter your email below and check the subscribe box — no message needed. Students get daily practice questions and study tips. Teachers get curriculum resources and teaching strategies.
Message Sent!
Thanks for reaching out. I'll get back to you within 24 hours.
Prefer email? Reach me directly at [email protected]