Merged
Conversation
Python implementation of Huffman Coding using Greedy Approach
Contributor
Author
|
Python implementation of Huffman Coding using Greedy Approach |
Member
|
@ASHMITA-DE Please look into the file structure. Create a Huffman Coding folder inside Greedy, put your code there. |
Implementation of Huffman Coding using Greedy Approach.
Contributor
Author
Done. |
Contributor
Author
|
Done
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
…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>
.
|
Contributor
Author
|
@indrarahul2013 , could you please classify the repository as ‘hacktoberfest’ eligible. Thank you. |
Contributor
Author
|
@indrarahul2013 , as per the new rules of Hacktoberfest 2020, could you please label this pull request as "hacktoberfest-accepted"? Thank you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.