Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Create Huffman_Coding.py #279

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
indrarahul merged 5 commits into codeIIEST:master from ASHMITA-DE:master
Oct 3, 2020
Merged

Create Huffman_Coding.py #279

indrarahul merged 5 commits into codeIIEST:master from ASHMITA-DE:master
Oct 3, 2020

Conversation

Copy link
Contributor

@ASHMITA-DE ASHMITA-DE commented Oct 1, 2020

Python implementation of Huffman Coding using Greedy Approach

Thank you for your contribution. Please provide the details requested below.

ISSUE NUMBER

#279

SHORT DESCRIPTION

Huffman Coding is a technique of compressing data to reduce its size without loss of data. It is generally useful to compress the data in which there are frequently occurring characters.
It follows a Greedy approach since it deals with generating minimum length prefix-free binary codes.
It uses variable-length encoding scheme for assigning binary codes to characters depending on how frequently they occur in the given text.
Priority Queue is used for building the Huffman tree such that the character that occurs most frequently is assigned the smallest code and the one that occurs least frequently gets the largest code.
It follows this procedure: -
Create a leaf node for each character and build a min heap using all the nodes (The frequency value is used to compare two nodes in min heap)
Repeat Steps 3 to 5 while heap has more than one node
Extract two nodes, say x and y, with minimum frequency from the heap
Create a new internal node z with x as its left child and y as its right child. Also frequency(z)= frequency(x)+frequency(y)
Add z to min heap
Last node in the heap is the root of Huffman tree

TESTING

Just run it on any IDE.

Python implementation of Huffman Coding using Greedy Approach
Copy link
Contributor Author

Python implementation of Huffman Coding using Greedy Approach

Copy link
Member

@ASHMITA-DE Please look into the file structure. Create a Huffman Coding folder inside Greedy, put your code there.

Copy link
Contributor Author

@ASHMITA-DE Please look into the file structure. Create a Huffman Coding folder inside Greedy, put your code there.

Done.

Copy link
Contributor Author

ASHMITA-DE commented Oct 2, 2020 via email

...
On Fri, Oct 2, 2020 at 7:51 AM Rahul Indra ***@***.***> wrote: @ASHMITA-DE <https://github.com/ASHMITA-DE> Please look into the file structure. Create a Huffman Coding folder inside Greedy, put your code there. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#279 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AOI5FFH222V4FBJFMD7ICTDSIU2K5ANCNFSM4SAYTSBQ> .

@indrarahul indrarahul merged commit 85e3fee into codeIIEST:master Oct 3, 2020
Copy link
Contributor Author

@indrarahul2013 , could you please classify the repository as ‘hacktoberfest’ eligible. Thank you.

Copy link
Contributor Author

@indrarahul2013 , as per the new rules of Hacktoberfest 2020, could you please label this pull request as "hacktoberfest-accepted"? Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /