Skip to content

Furqan3/Text-Compresser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Huffman Text Compressor Program with GUI in C++

This program implements a text compression algorithm using Huffman encoding in C++. The program provides a Command Line Interface (CLI) based GUI.

Prerequisites

  • A C++ compiler that supports C++11 standard.
  • CMake

Usage

After running the program, the user will be presented with the following options:

  • Compress text
    • To compress text, select the Compress text option and enter the path to the input text file. The compressed output will be written to a file named output.huff.
  • Decompress text
    • To decompress text, select the Decompress text option and enter the path to the compressed text file (i.e.,output.huff). The decompressed output will be written to a file named output.txt.
  • Exit

Implementation Details

The program uses the Huffman encoding algorithm to compress text. Huffman encoding is a variable-length prefix coding algorithm that assigns shorter codes to more frequently occurring characters in the input text.

The program first reads the input text and computes the frequency of each character. It then constructs a Huffman tree by repeatedly merging the two least frequent characters until a single tree is formed. The Huffman codes for each character are determined by traversing the tree from the root to the leaf corresponding to that character.

The compressed output consists of the Huffman tree (in a serialized form) followed by the encoded text. The Huffman tree is used to decompress the text.

Acknowledgements

This program was developed as a project for the Data Structures and Algorithms course at NUST College of EME.

GUI

Starup GUI

image

File Dailog

image

After Opning text file

image

Original file

image

Size of original File

image

Size of Compressed file

image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published