Skip to content

Your-vo1d/Arithmetic-compression

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Huffman Encoding and Decoding

This Python script implements Huffman encoding and decoding algorithms. Huffman encoding is a widely used technique for lossless data compression.

Usage

  1. Make sure you have Python installed on your system.

  2. Clone this repository or download the main.py file.

  3. Open a terminal or command prompt.

  4. Navigate to the directory containing the main.py file.

  5. Run the script using the following command:

    main.py
    
  6. Follow the instructions to enter the name of the file you want to encode.

  7. The encoded and decoded files will be saved in the result directory.

Description

The script provides two main functions:

  • encode(input_file, encode_file): Encodes the contents of the input file using Huffman encoding and writes the encoded data to the specified output file.
  • decode(encode_file, decode_file): Decodes the encoded data from the input file and writes the decoded text to the specified output file.

File Structure

  • main.py: The main Python script.
  • result: Directory to store the encoded and decoded files.
  • README.md: Documentation explaining how to use the script.

Requirements

  • Python 3.x
  • The input file to be encoded

Example

Suppose you have a text file named input.txt that you want to encode:

  1. Run the script and enter input.txt when prompted.
  2. The encoded file (encode.txt) and the decoded file (decode.txt) will be created in the result directory.

Author

This script was written by Your_Vo1d.

Releases

No releases published

Packages

No packages published

Languages