Assignments |
Class Photo |
Course Home |
Schedule & Lecture Notes |
Submit |
Tutoring Hours
|
Computer Science 140
Introduction to Computer Science
Spring 2008 |
|
Assignment
03
Data Representation and Compression
Contents:
Overview
Topic: Data Representation and Compression
Related Reading: Ch. 3.1, 3.3-3.6 and notes
Due:
8pm Tuesday, 12 February 2008
Problems to be Submitted (20 points)
- (6 points)
In the notes, we stated that CD quality music requires 44100 samples
per second. The amplitude of the sound wave is recorded using 16 bits per
channel. (Recorded in stereo, there are two separate channels). Based on
this information, please answer the following:
-
Calculate how many bits of information would be used to represent a 4 minute
song, recorded in stereo. Express your answer using the most natural unit
of magnitude (e.g., bytes, KB, MB, GB). Please explain the details of your
calculations so that we can better understand your method in case of a
wrong answer.
-
Assume that a single compact disk, formatted for audio, holds up to 700MB
of information. Approximately how many of those 4-minute songs will fit
on the CD.
- (6 points)
Consider the following Huffman code.
code | character |
00 | A |
11 | E |
010 | T |
0110 | C |
0111 | L |
1000 | S |
1011 | R |
10010 | O |
10011 | I |
101000 | N |
101001 | F |
101010 | H |
101011 | D |
Decode each of the following bit strings according to that code.
-
1000110110101111010
-
1010111101101001010101111
-
01101001010100001011101000010
- (8 points)
Consider the text "PETER PIPER PICKED PICKLED PEPPER PECKS" (a
slight variation on the classic tongue-twister to simplify your problem).
It contains 39 characters, with the following frequencies:
Letter |
Frequency |
P |
9 |
E |
8 |
blank |
5 |
C |
3 |
I |
3 |
K |
3 |
R |
3 |
D |
2 |
L |
1 |
S |
1 |
T |
1 |
-
If using the minimal fixed-length code possible for this
alphabet set, how many bits per character
must be used, and thus how many overall bits would be used to represent
all 39 characters of the message.
-
Based on the method discussed in the lecture notes, generate a Huffman
code for this set of frequencies (Note: this method was not discussed in
the text). Your answer should be a table of codes, formatted similarly
to the one given for problem B of this homework.
-
Based on your Huffman code, how many overall bits would be used to represent
all 39 characters in the message?
-
What compression ratio was achieved over the fixed-length code in part
a?
Overall, please type your answers to all of the problems in a
single document to be submitted electronically. Please see details about the
submission process.
Extra Credit (2 points)
Let's say that you are taking pictures at a resolution of
1024x768 pixels and that it stores 24-bit color for each
individual pixel. Assuming that pictures are stored in raw
form (that is, not using any compressed file format), please
answer the following questions.
-
Calculate how many bits of information would be used to
represent a single such picture. Express your answer using
the most natural unit of magnitude (e.g., bytes, KB, MB,
GB). Please explain the details of your calculations so
that we can better understand your method in case of a
wrong answer.
-
Approximately how many pictures could be stored on a 512MB
USB flash drive?
CSCI 140, Spring 2008
Michael Goldwasser © 2008
goldwamh at our university domain
Last modified: Wednesday, 19 September 2007
Assignments |
Class Photo |
Course Home |
Schedule & Lecture Notes |
Submit |
Tutoring Hours