Huffman Coding

9,061 views

Published on

Published in: Education, Technology
5 Comments
19 Likes
Statistics
Notes
No Downloads
Views
Total views
9,061
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
11
Comments
5
Likes
19
Embeds 0
No embeds

No notes for slide

Huffman Coding

  1. 1. Huffman Coding Presented By: Ehtisham Ali
  2. 2. ObjectivesWhat are Huffman Codes ?Why Huffman Codes are used ?
  3. 3. IntroductionAn effective and widely used Application ofBinary Trees and Priority QueuesDeveloped by David.A.Huffman while he was a Ph.d student at MIT andpublished in the 1952 paper “A Method for the Construction of MinimumRedundancy Codes”.Each code is a binary string that is used for transmission of thecorresponding message.For Example : BAGGAGE 100 11 0 0 11 0 101 Plain Text Huffman Code
  4. 4. Major Steps baggage1. Prepare the frequency table.2. Construct the binary tree. Alphabets Frequencies3. Extract the Huffman Code from the tree. b 1 a 2 g 3 Binary Tree e 1 This Huffman Code is now used for the transmission of word “baggage”. Huffman Code 100 11 0 0 11 0 101 b a g g a g e
  5. 5. Algorithmn <- |C|Q <- Cfor i <- 1 to n-1 do allocate a new node z left [ z ] <- x <- EXTRACT-MIN (Q) right [ z ] <- y <- EXTRACT-MIN (Q) f [ z ] <- f [ x ] + f [ y ] INSERT(Q, Z)return EXTRACT-MIN (Q)
  6. 6. AnalysisTime Complexity: Time complexity of Huffman algorithm is O(nlogn) where eachiteration requires O(logn) time to determine the cheapest weight and therewould be O(n) iterations.
  7. 7. Applications Of Huffman CodingSupports various file type as: ZIP (multichannel compression including text and other data types) JPEG MPEG (only upto 2 layers)Also used in steganography for JPEG carrier compression.
  8. 8. ConclusionLike many other useful algorithms we do require Huffman Algorithm forcompression of data so it could be transmitted over internet and othertransmission channels properly.Huffman algorithm works on Binary trees. Huffman DATA Huffman Code Algorithm

×