DSA_Code icon indicating copy to clipboard operation
DSA_Code copied to clipboard

[REQUEST] Add Huffman Coding in cpp

Open harshendram opened this issue 1 year ago • 2 comments

Algorithm Name

Huffman Coding

Programming Language

C++

Category

Greedy Algorithms

Difficulty Level

Medium (Intermediate)

Algorithm Description

Huffman Coding is a clever method for compressing data by assigning variable-length codes to characters based on how frequently they appear. Common characters get short binary codes, while rare characters get longer ones, similar to how 'E' is a single dot in Morse code. The algorithm builds a special binary tree by repeatedly merging the two least frequent characters until a single tree is formed. By traversing this tree, a unique, prefix-free code (where no code is the prefix of another) is generated for each character, resulting in an overall smaller file size.

References (Optional)

No response

Contribution Intent

  • [x] I would like to implement this algorithm myself
  • [ ] I'm requesting this for someone else to implement
  • [ ] I need help implementing this algorithm

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

harshendram avatar Oct 01 '25 14:10 harshendram

Hi @harshendram , please assign this issue to me!

Priyanshiunique avatar Oct 01 '25 14:10 Priyanshiunique

@Priyanshiunique just open the new PR

Karanjot786 avatar Oct 01 '25 15:10 Karanjot786