0% found this document useful (0 votes)
15 views

Huffman Coding

Uploaded by

UNKNOWN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Huffman Coding

Uploaded by

UNKNOWN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

MMW

Huffman Coding
Louie Jocson
Rizalina Dauz
Target Objectives
Know the history How does
01 of huffman 02 huffman coding
coding work

03

Sample problem
01 History
How it begin?
History
• In 1951, David A. Huffman and his MIT information
theory classmates were given the choice of a term
paper or a final exam. The professor, Robert M. Fano,
assigned a term paper on the problem of finding the
most efficient binary code. Huffman, unable to prove
any codes were the most efficient, was about to give up
and start studying for the final when he hit upon the
idea of using a frequency-sorted binary tree and quickly
proved this method the most efficient.

• Formal algorithm was published in 1952 in his paper


titled “A method for the construction of minimum-
redundancy codes” David Albert Huffman Robert M. Fano
02
How does it
work?
What’s the exact purpose of
huffman coding and how can we
identify it?
What is Huffman
coding?
Huffman Coding is a technique of compressing
data to reduce its size without losing any of the
details. It was first developed by David Huffman.

Huffman Coding is generally useful to compress


the data in which there are frequently occurring
characters.
It’s uses
File/File
Compression Image and Video
Compressions
Zip, and other file compression
Assigning shorter codes to
formats use huffman coding.
often occurrence of pixel in
images, while huffman
Text Compression aids video compressions
like MPEG
Tools
Huffman coding can be used Storing Data
in text compression tools
Also used in some data
storage systems.
What is Huffman
coding?
• Huffman Coding is also a lossless data encoding
algorithm. The process behind its scheme
includes sorting numerical values from a set in
order of their frequency. The least frequent
numbers are gradually eliminated via the Huffman
tree, which adds the two lowest frequencies from
the sorted list in every new “branch is created.

• it moves the general direction of the tree either to the right


(for higher values) or the left (for lower values).

• When the sorted list is exhausted and the tree is


complete, the final value is zero if the tree ended
on a left number, or it is one if it ended on the
right. This is a method of reducing complex code
into simpler sequences and is common in video
encoding.
Definition of Terms
Frequency sorted binary tree - is a binary search tree that has
the property that the frequency of each element in the tree is equal to the
number of nodes that contain that element.

Lossless - A form of compression that encodes digital files


without losing detail. Files can also be restored to their
uncompressed quality.

Huffman Tree - or Huffman coding tree defines as a full binary tree in


which each leaf of the tree corresponds to a letter in the given alphabet. is
treated as the binary tree associated with minimum external path weight
that means, the one associated with the minimum sum of weighted path
lengths for the given set of leaves.
So the goal is to construct a tree with the minimum external path weight.
03
Sample Problem
Come solve the true nature of
Huffman coding!
HUFFMAN CODING
GIVEN: AABCBAD

Step 1: Make a Frequency Table and


count the frequency of each letter
Step 5: Assign Huffman
Step 2: Write letters in order of frequency , codes to each letter
starting with the most frequent on the left
based on their frequency
Step 3: Join the least frequent letters to and use these codes to
make a new note and repeat this process
until we have a priority queue with only one encode and decode the
item.
original text.
Step 4: Rewrite and represent a Huffman tree,
where the left side represents binary bit 0 and the
right side represents binary bit 1.
Visual Help
AABCBAD

A 3
B 2

C 1

D 1
Visual Help
AABCBAD

A 3
B 2

C 1

D 1
Visual Help
CHARACTER FREQUENCY CODE
A 3 0
B 2 10

C 1 110

D 1 111

GIVEN: AABCBAD

A A B C B A D 0 0 10 110 10 0 111
0 0 10 110 10 0 111 A A B C B A D
References
History of Huffman Coding:
Huffman Coding:
Wikipedia Contributors. (2019, July 12).
● Programiz. (n.d.). Huffman Coding
Huffman coding. Wikipedia; Wikimedia
Algorithm. Www.programiz.com.
Foundation.
https://www.programiz.com/dsa/huffma
https://en.wikipedia.org/wiki/Huffman_coding
n-coding
Definition of Terms (FSB Tree, Lossless,
Huffman Tree :
● Lossless - Data compression - Fundamentals of data ● What is Huffman Coding? - Definition
representation - AQA - GCSE Computer Science Revision - from Techopedia. (n.d.).
AQA. (n.d.). BBC Bitesize.
https://www.bbc.co.uk/bitesize/guides/zd88jty/revision/9
Techopedia.com.
● Huffman Tree - Huffman Trees in Data https://www.techopedia.com/definition/
Structure. (n.d.). Www.tutorialspoint.com. 7627/huffman-coding
https://www.tutorialspoint.com/huffman-
trees-in-data-structure


Thank you for
listening!
We can be more, and we
can do so much more -
Unknown

You might also like