Skip to content

Latest commit

 

History

History
39 lines (24 loc) · 1.73 KB

README.md

File metadata and controls

39 lines (24 loc) · 1.73 KB

File-Compression System Using Huffman Coding in C++

The project is to design compression and decompression programs using Huffman Coding. The idea is to assign variable length codes to input characters based on their frequencies. The more the frequency of the character the shorter the code assigned to it.

#Implementation:

The program has been implemented in C++ language. The idea is to reduce the weighted expected storage by means of assigning shorter codes to frequently occurring characters.

#Compression:

Provide the input. Note the frequency of all the characters in the input. Construct a min priority queue with respect to the frequencies of the characters. Construct Huffman Tree from the priority queue. Encode the file, store the encoding table and compress the input based on the encoding table.

The codes are stored as bits and each character is provided a prefix code which is a string of bits.

image

#Decompression:

Open the file and reconstruct the Huffman Tree based on the Encoded table. Decode the file and store it to the desired file.

image

#Finding Compression Rate:

A compression varying from 6-7% of the initial input file is achieved.

image

#Output:

  1. Codes - OutPut

  2. Output - OutPut1