Computer Science and Digital Literacy · 35 minutes

Suggested grades 9–12 · Unit 2: Data quality and representation · Lesson 2 of 2

Binary Values and Run-Length Encoding

Follow two explicit representations and check whether compression actually saves space.

Mr. S Teaches · Original starter lesson · HS-CS-04 · Grade range is planning guidance.

Watch, notice, discuss

Video choices for this lesson

2 choices

Preview a video, then choose what fits your learners. “Show to class” opens a larger view; use the player’s play and full-screen controls when you’re ready.

Teacher preview needed. Check the language, level and length before showing. YouTube may show ads or related videos.

OPTION 2 · YOUTUBE

Representing Numbers and Letters with Binary: Crash Course Computer Science #4

By CrashCourse

Review binary representation before encoding and decoding the lesson’s short sequence.

Open on YouTube: Representing Numbers and Letters with Binary: Crash Course Computer Science #4 (opens a new tab) ↗
After watching

When does run-length encoding save space under the stated format?

An external player loads only after you choose Preview or Show to class. Playback connects to YouTube. Videos belong to their creators; availability and embedding can change.

Learning objective

Encode and decode a short binary sequence and justify its storage comparison under a stated format.

Before you begin

  • Place value
  • Counting repeated symbols

Gather your materials

  • Paper and pencil
  • Four binary place-value cards

Language to know

bit
A binary digit,0 or 1.
positional value
A digit’s contribution determined by its place.
run-length encoding
Representing consecutive repeated symbols by a symbol and count.

Understand the concept

For four unsigned binary places, the weights are 8,4,2,1. The string 1011 therefore represents 11. A separate compression exercise uses literal symbol-count pairs separated by semicolons:00001110 becomes 0:4;1:3;0:1. The format is explicitly text,not a universal binary compression standard. Whether it saves space depends on counting all characters,including separators,under the chosen representation.

Teach it step by step

  1. Convert 1011 by adding the weights for its 1 bits and reverse the process for decimal 6.
  2. Read the stated symbol: count format and split 00001110 into consecutive runs.
  3. Encode,then decode by expanding each pair in order and compare with the original.
  4. Count encoded text characters versus the eight raw characters and test an alternating sequence.

Make the thinking visible

Worked example or model response

1011=8+2+1=11;6 is 0110. Encoding 00001110 yields 0:4;1:3;0:1,which has 11 text characters versus 8 raw characters,so this tiny example expands under the stated character-count model.

Guided practice

Encode 111100 and decode 0:2;1:1;0:3. Convert binary 1100 to decimal.

Independent practice

1. Write decimal 9 in four-bit binary. 2. Encode 0101 and compare character counts. 3. Explain why this toy format must specify what happens with an invalid or missing count.

Quick assessment

Does the name“compression”guarantee every input becomes shorter?

Answer key & assessment criteria

Answers and teaching guidance

  1. Guided:1:4;0:2; decoded 001000;1100=12.
  2. Independent 1:1001. 2:0:1;1:1;0:1;1:1 has 15 characters versus 4 raw. 3: An ambiguous or invalid count prevents deterministic decoding; a real format needs validation rules.
  3. Quick check: No. Repetition,data size and format overhead determine the result.

Look for: Require the learner to explain the interpretation and check, not only state a result. Assess the written trace or evidence record; do not request real passwords, accounts or personal data.

Make it work for your learner

More support

Use four place-value boxes and group identical symbols with brackets before encoding.

Extension challenge

Find a long repeated input for which the stated text format does save characters and calculate the reduction.

Verified references · Selected contributions

Standards connections

Subject-content alignment not yet verified

Supporting literacy connections

These records apply to the specified reading, writing or communication task. They do not establish subject-content alignment.

Supporting Common Core connection

RST.9-10.3

Common Core · Grades 9–10

Follow encoding and decoding procedures precisely and attend to representation exceptions.

Read the official standard ↗

Supporting grades 9–10 technical-literacy practice in the stated task, not a verified computer-science content alignment or full text-complexity assessment.

Verified 2026-11-04. Selected contribution, not full attainment.