GithubHelp home page GithubHelp logo

tula18 / huffman_coding Goto Github PK

View Code? Open in Web Editor NEW

This project forked from e-hengirmen/huffman-coding

0.0 1.0 0.0 170 KB

A C++ compression program based on Huffman's lossless compression algorithm and decoder

License: MIT License

C++ 99.41% Makefile 0.59%

huffman_coding's Introduction

Huffman Coding

MIT License MIT License

Self-made C++ file archiver and archive extractor programs based on Huffman's lossless compression algorithm

Table of Contents

How does it work?

You can check out documentation inside Compressor.cpp and Decompressor.cpp files to help you understand Huffman's algorithm's inner workings.

Compressor:

The Compressor is a 2-pass program. What I mean by this is that the Compressor reads input files twice.

In the first pass, the program counts usage frequency of every unique byte and creates a weighted translation tree for every used unique byte inversely proportional to its usage frequency and then writes this transformation info to the compressed file for decompression purposes

In the second pass, the program translates input files according to the translation tree and writes it to the newly created compressed file

Decompressor:

The Decompressor is a 1-pass program: The Decompressor first reads translation info and creates a binary tree from it. After this process is done, it uses this binary translation tree to decode the rest of the file

How to use it?

  1. Compile with make using your favourate shell:
make all
  1. After running make, you can use archive command below to compress the file you want:
  • To compress one file use:
./archive {{filename}}
  • To compress multiple files use:
./archive {{filename1}} {{filename2}} ...
  1. And to decompress a compressed file, use the extract command below:
./extract {{filename}}

Versions

  • Version 2.0(Latest Version)
    • Can compress any file and folder you want
    • Useful for educative purposes
    • Uses more functionalized structure
  • Version 1.0
    • Compresses multiple files
    • Version 1.0 can not be used to compress folders
  • Version 0.9
    • Compresses 1 file at a time
    • Version 0.9 can not be used to compress folders
    • Easier to understand
    • Useful for educative purposes

huffman_coding's People

Contributors

e-hengirmen avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.