- 73 Views
- Uploaded on
- Presentation posted in: General

Huffman Encoding and Decoding

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Huffman Encoding and Decoding

SarkerTanveer Ahmed Rumee (1000672838)

Md. Abdus Salam (1000667054)

- Problem definition
- The Huffman Algorithm
- Analysis of the Algorithm
- Implementation
- Results
- Conclusion

- 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

- 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)

- 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).

- 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.

- 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)

- Compression Ratio (CR)

NB :Values in the table indicate compression Ratio

- 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.

Thank You

Questions ??