Save
...
data representation
mod 2
huffman coding
Save
Share
Learn
Content
Leaderboard
Share
Learn
Created by
emily d
Visit profile
Cards (22)
What is Huffman coding used for?
It is used for
data
compression
View source
How many bits does each character take up without compression?
8
bits
View source
How does Huffman coding assign bit patterns to characters?
More
frequent
characters get
shorter
bit
patterns
View source
In the word "MISSISSIPPI," how many characters are there?
11
characters
View source
How many times does the character 'm' occur in "MISSISSIPPI"?
1
time
View source
How many times does the character 'i' occur in "MISSISSIPPI"?
4
times
View source
How many times does the character 's' occur in "MISSISSIPPI"?
4
times
View source
How many times does the character 'p' occur in "MISSISSIPPI"?
2
times
View source
What is the size of the compressed file for "MISSISSIPPI"?
21
bits
View source
What is the original file size of "MISSISSIPPI" before compression?
88
bits
View source
What type of compression is Huffman coding?
Lossless
compression
View source
The
Huffman code
is constructed using a
binary tree
where nodes are assigned values based on their
frequency
of occurrence.
Huffman Coding
: The most
commonly
used
lossless
compression algorithm.
In
Huffman coding
, symbols with
higher
frequencies have shorter
codes
while those with
lower
frequencies have longer codes.
Character
Bit pattern
L
-0
O -10
H -110
E -111
Write down the full bit pattern for the compressed word HELLO. Use the table above to help you with this.
110
,
111,0
,
0
,
10
The
Huffman tree
can be represented as an array or linked list to store the
code lengths
.
0 left
1 right
file size of compressed file for GEMINI
14
size of
compression
:
dividing the size of the
compressed
file by the
original
size.
file size
of
compressed
=
count
0 and 1s
ascii
A
=
65
a=
97
Huffman Coding
is used to compress
files
, especially text-based files like
source codes
, documents, etc.