Code Monkey home page Code Monkey logo

mehboobali98 / huffman-encoding-using-priority-queue Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 225 KB

A modified Huffman algorithm is implemented for compressing sequences of characters from an alphabet of size n, where the characters occur with known frequencies f1, f2, …, fn. The algorithm encodes each character with a variable-length codeword over the values 0, 1, 2 such that no codeword is a prefix of another codeword and so as to obtain the maximum possible compression.

CMake 30.30% C 25.17% C++ 31.82% Makefile 12.71%
huffman-coding huffman-compression-algorithm priority-queue ternary-huffman

huffman-encoding-using-priority-queue's Introduction

Ternary Huffman Encoding Using Priority Query

A modified Huffman algorithm is implemented for compressing sequences of characters from an alphabet of size n, where the characters occur with known frequencies f1, f2, …, fn. The algorithm encodes each character with a variable-length code word over the values 0, 1, 2 such that no code word is a prefix of another code word and so as to obtain the maximum possible compression.

Time Complexity

To count the frequency of each character in the alphabet, count sort is used which takes O (N). Priority Queue operations take O (log N) time and these are called in a loop for n/2 characters. Therefore, the overall time complexity would be O (N log N).

Correctness Proof

The detailed proof is given the Proof.pdf file.

Directory Structure

📦Huffman-Encoding-Using-Priority-Queue
 ┣ 📜CMakeLists.txt
 ┣ 📜main.cpp
 ┣ 📜Proof.pdf
 ┗ 📜README.md

huffman-encoding-using-priority-queue's People

Contributors

mehboobali98 avatar

Watchers

 avatar  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.