1 / 12

Huffman Encoding and Decoding

Huffman Encoding and Decoding. Sarker Tanveer Ahmed Rumee (1000672838) Md. Abdus Salam (1000667054). Outline. Problem definition The Huffman Algorithm Analysis of the Algorithm Implementation Results Conclusion. Problem Definition. Take a text file as input Encode it so that-

trilby
Download Presentation

Huffman Encoding and Decoding

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Huffman Encoding and Decoding SarkerTanveer Ahmed Rumee (1000672838) Md. Abdus Salam (1000667054)

  2. Outline • Problem definition • The Huffman Algorithm • Analysis of the Algorithm • Implementation • Results • Conclusion

  3. Problem Definition • Take a text file as input • Encode it so that- • Less space is used to store the characters of this text • No information is lost- we can reconstruct the original text

  4. Huffman Algorithm • Data Structure used: Priority queue = QHuffman (c)n = |c|Q = cfori =1  to   n-1do   z = Allocate-Node ()             x = left[z] = EXTRACT_MIN(Q)             y = right[z] = EXTRACT_MIN(Q)            f[z] = f[x] + f[y]            INSERT (Q, z)return EXTRACT_MIN(Q)

  5. Analysis of the Algorithm • Q implemented as a binary heap. • line 2 can be performed by using BUILD-HEAP in O(n) time. • FOR loop executed |n| - 1 times and since each heap operation requires O(lg n) time. => the FOR loop contributes (|n| - 1) O(lg n) => O(n lg n) • Thus the total running timeof Huffman on the set of n characters is O(nlg n).

  6. Implementation • PLATFORM : Microsoft windows 9x,NT,2000,XP • PROGAMMAING LANGUAGE : Java (J2SE) • PROGRAMMING TOOL : Eclipse and NetBeans IDE • Code implemented has two module: • Encode (Compress) the input text/file. • Decode (Decompress) the encoded file.

  7. Results • Performance criteria • Compression Ratio (CR) The ratio is calculated using the following formula: CR = (Input File Size - Compressed File Size/Input File Size) * 100.0 • We also show the top 12 most frequent characters found in the original input file and then match with ETAOIN SHRDLU – which is the 12 most frequent characters (sorted from highest to lowest frequencies) in English language. (Most commonly in newspapers)

  8. Performance of Huffman Algorithm over various inputs

  9. Comparison with other efficient compression softwares NB :Values in the table indicate compression Ratio

  10. Conclusion • In the end, Huffman Algorithm is a good base to understand how the compression algorithm works. • For data compression more sophisticated techniques are available now. • Huffman algorithm can be modified to perform image compression.

  11. Thank You

  12. Questions ??

More Related