X Tutup
Skip to content

Add Huffman Coding greedy algorithm implementation#7303

Open
putku45 wants to merge 2 commits intoTheAlgorithms:masterfrom
putku45:putku45-patch-1
Open

Add Huffman Coding greedy algorithm implementation#7303
putku45 wants to merge 2 commits intoTheAlgorithms:masterfrom
putku45:putku45-patch-1

Conversation

@putku45
Copy link

@putku45 putku45 commented Mar 10, 2026

Added Huffman Coding greedy algorithm implementation.

Huffman Coding is used for optimal prefix coding and data compression.

Time Complexity: O(n log n)
Space Complexity: O(n)

Reference:
https://en.wikipedia.org/wiki/Huffman_coding

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized it.
  • All filenames are in PascalCase.
  • All functions and variable names follow Java naming conventions.
  • All new algorithms have a URL in their comments that points to Wikipedia or other similar explanations.
  • All new algorithms include a corresponding test class that validates their functionality.
  • All new code is formatted with clang-format -i --style=file path/to/your/file.java

putku45 added 2 commits March 10, 2026 10:56
Added Huffman Coding algorithm implementation.

Huffman Coding is a greedy algorithm used for optimal prefix coding and data compression.

Reference:
https://en.wikipedia.org/wiki/Huffman_coding
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 0% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.35%. Comparing base (9aa2544) to head (1b6caf9).

Files with missing lines Patch % Lines
.../thealgorithms/greedyalgorithms/HuffmanCoding.java 0.00% 18 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #7303      +/-   ##
============================================
- Coverage     79.42%   79.35%   -0.08%     
+ Complexity     7062     7061       -1     
============================================
  Files           788      789       +1     
  Lines         23129    23147      +18     
  Branches       4548     4550       +2     
============================================
- Hits          18371    18369       -2     
- Misses         4024     4043      +19     
- Partials        734      735       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

X Tutup