Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
adeesha-savinda authored Oct 12, 2020
1 parent dc3b9fd commit c4f7598
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Compression of Text using Huffman Coding
This implementation has two seperate C programs. One will input a text file and will output a compressed version of the text file into two separate files. One is the **.huffman** file which has the content. The other file is **.table** file where it contains the huffman lookup table. The other program is used for decompression. This program inputs the above generated two **.huffman** file and **.table** file and will output a **.txt** file.
This method of coding was introduced by David A. Huffman In 1951. while he was a Ph.D. student at MIT. He was given the task to find an efficient way of coding and came up with the idea of using a **frequency-sorted binary tree** and proved this method to be the most efficient. He published a paper in 1952 titled "[A Method for the Construction of Minimum Redundancy Codes](http://compression.ru/download/articles/huff/huffman_1952_minimum-redundancy-codes.pdf)".

## Data Compression
Expand Down Expand Up @@ -51,3 +52,12 @@ Compile both of the programs called huffman_encode.c and huffman_decode.c using
gcc -o huffman_encode huffman_encode.c
gcc -o huffman_decode huffman_decode.c
```
After Compiling use the **huffman_encode** binary to encode or compress any given text file in **.txt** format. For example, if you input **abc.txt** file, this will output two separate files in the same directory with **abc.huffman** and **abc.table** extensions.
```
huffman_encode abc.txt
```
Use the **huffman_decode** binary to decode or decompress any **.huffman** and **.table** file. These two files are mandatory. The decoded file will be saved in a directory with extension **.decoded**
```
huffman_decode abc.huffman
```

0 comments on commit c4f7598

Please sign in to comment.