If you were punished and had to write "I will not talk in class" 100 times, would your hand get tired? Would you wish for a magic spell where you could write it just once and use arrows to point to the rest?
Congratulations! You think exactly like a computer scientist.
Computers have limited hard drive space, and sending data over the internet takes time. To "save space" and "save time," computers invented a magic trick to shorten text, which we call "Compression." Today, we don't need a computer; we only need paper and a pen to crack this code.
Phase 1: The Need for Speed (Discovering the Pain Point)

- Dictation Challenge: Prepare a nursery rhyme with high repetition (like The Rain or Baby Shark).
- Teacher: "I am going to read a poem. Please write down every single word. Let's see who can write the fastest."
- Read: Read deliberately fast. "Pitter patter, pitter patter, listen to the rain..."
- Observe: The child will complain about being too slow or their hand hurting.
Constructive Inquiry:
- Teacher: "Did you notice anything particular about this poem?"
- Child: "Yes! It keeps repeating 'Pitter patter'!"
- Teacher: "If you were a super smart scribe, could you find a way to write fewer words, but still make sure people can read the poem perfectly?"
- (Listen to their creativity: They might write "x2" or draw arrows.)
Phase 2: The "Box and Pointer" Method (Inventing Symbols)
Introduce the concept of "Pointers," describing them as a "labor-saving tool."
1. Demonstration:
- Teacher"Your arrows are great! Computers use a similar method. When a computer sees a word that has appeared before, it draws a box around it, and the next time it needs to write it, it uses an arrow to point back and say: 'Hey, same as that one!'"

2. Practical Exercise:
- Teacher"Look at this picture. Some words are missing, and only the road signs (arrows) remain. You are the decoder. Follow the arrows back to find the original words and fill them in."
- Observation Points:Guiding Reflection:
- Does the child notice the arrow points to "how many words"?
- Does the child understand what the start and end of the arrow represent?

Phase 3: Pushing the Limits (The "Banana" Problem)

The example of turning Ban(2,3) into Banana is the most brain-twisting yet essential part of this activity.
In Computer Science, this is known as "Self-reference in the LZ77 Algorithm."
Children (and adults) often get stuck here:
"The computer tells me to count back 2 spaces and copy 3 letters. But looking back, there are only 2 letters ('a' and 'n'). The 3rd letter hasn't been written yet. How can I copy it?"
To teach this constructively, we must shift the concept from "Paste all at once" to a "One-by-one dynamic process."
1. Core Concept: Not "Copy-Paste," but a "Copycat Robot"
Traditional teaching treats (2,3) as a static instruction. In reality, it is a dynamic loop.
- The first number (2): How far back the "Copycat Robot" looks (Distance).
- The second number (3): How many steps the robot walks (Length/Repetition).
2. Step-by-Step Visualization
Let's take a strip of paper, write B, a, n, and draw three blanks _ _ _ after it.
Instruction:Look back 2 spaces, copy 3 times.。
Step 1
- Current State:B a n [ ] _ _
- Action: The cursor looks back 2 spaces.
- n (1 space back) ← a (2 spaces back)
- The robot sees a
- Write: Put a in the first blank.
- Result:B a n [a] _ _
Step 2
- Current State:B a n a [ ] _
- Key Point: The robot still follows the rule "Look back 2 spaces."
- Action: The cursor looks back 2 spaces.
- a (1 space back) ← n (2 spaces back)
- The robot sees n。
- WritePut n in the blank.
- Result:B a n a [n] _
Step 3 — The Magic Moment
- Current State:B a n a n [ ]
- Action: Robot continues to "Look back 2 spaces."
- n (1 space back) ← a (2 spaces back)
- Notice! Who is this a? It is the same a we just wrote in Step 1!
- We are copying "something new that was just created."
- Write: Put a in the first blank.
- Result:B a n a n [a]
Try it
COMMAND_MODULE
MEMORY_BUFFER ADDR: 0x0000 – 0x0005
3. The Insight: What does this mean?
When Copy Length > Look-back Distance, a "Self-plagiarism" phenomenon occurs.
This represents a Repeating Pattern.
- Ban(2, 3) means: Take the last 2 letters an and use them as a stamp, stamping continuously until you fill 3 spots.
- What if it's Ban(2, 10) ?
- It becomes B + an an an an an... = Bananananana...
"The key to teaching the 'Banana' example lies in breaking the misconception of 'Static Copying' (or 'Static Copy-Paste').
Please use the concept of a 'Timeline' or 'Slow Motion' to guide the child to write it out by hand, letter by letter.
The moment they realize that the third letter 'a' is actually derived from the 'a' they just wrote in the first step, they will have grasped the most ingenious concept in compression algorithms: the 'Sliding Window.'"
Phase 4: Connecting to Reality (Why does it matter?)
Teacher: "Do you know why we go through all this trouble?"
- Teacher: "Imagine you have to pack an entire library of books into one suitcase. If the books contain many repeated sentences, and we use this 'arrow method,' will the books become thinner or thicker?"
- Summary: "This is why you can download games quickly or watch YouTube without it buffering forever. Because smart computers 'compress' the repeated data first, send it to your house, and then 'decompress' it to restore it. This is exactly how ZIP files and PNG images work!"
Teaching Observation Checklist
| Observation Point | Less Effective Reaction | More Effective Scaffolding |
| When the child doesn't know where the arrow points | "Look, the arrow points to P, so you write P." (Giving the answer) | "Try walking your finger along this line. Which word does it land on effectively? Who is that word?" |
| Handling the "Banana" Problem (Overlapping Match) | "The formula is (2,3): Back 2, Length 3." | "Let's pretend to be a robot. The only instruction is: 'Copy the letter that is 2 steps behind me.' Let's do this action 3 times and see what happens." |
| Discussing Efficiency | "The compression ratio formula is..." | "Which kind of book do you think is easiest to compress? A dictionary? Or a book that just says 'Blah blah blah' over and over again?" (Guiding to redundancy) |
💡 Advice for Parents/Teachers
The core of this article is "Visualization." Don't rush into numbers (like the Ban(2,3) challenge). First, get the child used to drawing boxes and pulling lines.
When a child can skillfully turn Twinkle Twinkle Little Star into a messy drawing full of arrows, they have mastered one of the core technologies of modern internet transmission: LZ Coding (Ziv-Lempel Coding).
Tell the child: "Next time you are punished to write lines, try writing the first line and then using arrows for the rest. See if your teacher admires your 'Computational Thinking'! (But you might get into trouble, so do it at your own risk XD)."
Reference :csunplugged text_compression
