Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lesson 2-2 AP Computer Science Principles

Similar presentations


Presentation on theme: "Lesson 2-2 AP Computer Science Principles"— Presentation transcript:

1 Lesson 2-2 AP Computer Science Principles
Text Compression Lesson 2-2 AP Computer Science Principles

2 Objectives Students will be able to:
Collaborate with a peer to find a solution to a text compression problem using the Text Compression Widget (lossless compression scheme). Explain why the optimal amount of compression is impossible or “hard” to identify. Explain some factors that make compression challenging. Develop a strategy (heuristic algorithm) for compressing text. Describe the purpose and rationale for lossless compression.

3 Journal When you send text messages to a friend, do you spell every word correctly? Do you use abbreviations for common words? List as many as you can.   Write some examples of things you might see in a text message that are not proper English.

4 Why??? Why do you use these abbreviations? What is the benefit?

5 Compression Today’s class is about compression
When you abbreviate or use coded language to shorten the original text, you are “compressing text.” Computers do this too, in order to save time and space. The art and science of compression is about figuring out how to represent the SAME DATA with FEWER BITS.

6 Compression Why is this important? One reason is that storage space is limited and you’d always prefer to use fewer bits if you could. A much more compelling reason is that there is an upper limit to how fast bits can be transmitted over the Internet. What if we need to send a large amount of text faster over the Internet, but we’ve reached the physical limit of how fast we can send bits? Our only choice is to somehow capture the same information with fewer bits; we call this compression.

7 Compression In the previous lessons we encoded and sent text in binary.  On computers, unlike your text messages, sometimes text gets really long (think: the entire contents of Wikipedia, or Shakespeare’s complete works) that you might want to send someone or download. What if we need to send this text faster over the Internet, but we’ve reached the physical limit of how fast we can send bits?  Our only choice is to somehow capture the same information with fewer bits; we call this compression. The solution is not unlike a very clever abbreviation scheme.

8

9 Text Compression Tool Video

10 Activity In your teams…
Take your Poem. Try and get the best compression you can in 5 minutes. So_wake_me_up_when_it's_all_over I_Need_a_Dollar The_Man A_tutor_who_tooted_the_flute She_sells_sea_shells I_know_an_old_lady Pease_porridge

11 Questions What makes doing this compression hard?
Do we think that these compression amounts that we’ve found are the best? Is there a way to know what the best compression is? But is there a process a person can follow to find the best (or a pretty good) compression for a piece of text?

12 Hueristic In computer science there is a word for strategies to use when you’re not sure what the exact or best solution to a problem is. Vocabulary: heuristic a problem solving approach (typically an algorithm) to find a satisfactory solution where finding an optimal or exact solution is impractical or impossible.

13 Activity Continue working on compressing your poem using the Text Compression Widget. As you do so, develop a set of rules, or a “heuristic” that generally seems to provide good results. Record your heuristic as a list of steps that someone else unfamiliar with the problem could follow and still end up with decent compression.

14 Activity Exchange Heuristics
Trade your heuristics with another group. Are they clear and specific enough that you always know what to do? If not, provide feedback to one another and improve your heuristics to provide clearer instructions.

15 Activity Once you have a heuristic you can follow, try it out on:
Pitter Patter A Tutor She Sells Sea Shells I Know an Old Lady Pease Porridge Record your result in the Activity Guide Complete the questions and turn it in at the end of class.

16 Important Terms to Know!
Lossless Compression v. Lossy Compression Heuristic

17 Stage 2 Complete Unit 2 Stage 2


Download ppt "Lesson 2-2 AP Computer Science Principles"

Similar presentations


Ads by Google