Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Huffman Coding: Design, Analysis, and Implementation, Lecture notes of Design and Analysis of Algorithms

An in-depth exploration of huffman coding, a popular data compression technique that utilizes a greedy strategy to produce optimal prefix codes based on character frequencies. The scope, advantages, and disadvantages of fixed and variable length coding, the concept of prefix codes, and the construction of a huffman tree. It also includes a pseudocode for the huffman coding algorithm and an exercise to draw the huffman tree and generate huffman codes for a given set of characters.

Typology: Lecture notes

2023/2024

Uploaded on 02/22/2024

drunkbastard
drunkbastard 🇮🇳

1 document

1 / 11

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
BCSE204L Design and
Analysis of Algorithms
Module-1
Huffman Coding (Greedy Technique)
Dr Athira K
SCOPE
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Huffman Coding: Design, Analysis, and Implementation and more Lecture notes Design and Analysis of Algorithms in PDF only on Docsity!

BCSE204L Design and

Analysis of Algorithms

Module- 1 Huffman Coding (Greedy Technique) Dr Athira K SCOPE

Data Compression Requirements

  • Storage and communication
  • Huffman codes compress data very effectively:

savings of 20% to 90% are typical

  • Greedy on the frequency of each character in

the data

  • Huffman coding is used widely as the basic building block of numerous other compression algorithms
  • Fixed length and variable length coding

Prefix Codes

  • Codes in which no codeword is also a prefix of some other codeword are called prefix codes
  • Advantage:- decoding without ambiguity
  • Prefix code can always achieve the optimal data compression among any character coding scheme

Prefix Codes Example

  • Encoding:- 𝑎𝑏𝑐 → 0 · 101 · 100 where · is concatenation
  • Therefore, instead of 𝑎𝑏𝑐 we send 0101100
  • Decoded at the receiving end without ambiguity, provided the receiver must know the coding table

Huffman Tree

  • Algorithm builds Huffman tree, 𝑇 in a bottom up manner
  • Initially a set of |𝐶| leaves and performs |𝐶| − 1 merge operations
  • Uses a min-priority queue 𝑄, keyed on the 𝑓𝑟𝑒𝑞 attribute

Huffman Coding Pseudocode

Exercise

  • Draw the Huffman tree and generate the Huffman code
  • Answer: a=111, e=10, i=00, o=11001, u=1101, s=01, t= a e i o u s t 10 15 12 3 4 13 1

Thank you..