Skip to content

Conversation

@Microindole
Copy link
Contributor

Description

This PR adds two fundamental lossless compression algorithms to the compression category:

  1. LZ77 (Lempel–Ziv 77): Implements compression using a sliding window approach.
  2. LZ78 (Lempel–Ziv 78): Implements compression using a dynamically built dictionary.

Both implementations include compress and decompress methods and are accompanied by comprehensive JUnit tests (LZ77Test.java, LZ78Test.java) to ensure correctness and handle edge cases like empty or null inputs.

Adding these algorithms enriches the compression package by providing classic examples of dictionary-based coding, complementing the existing LZW algorithm.

Related Issue

Closes #6909

Checklist

  • I have read the contribution guidelines.
  • I have tested my code.
  • I have followed the code style of the project.

@codecov-commenter
Copy link

codecov-commenter commented Oct 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.06%. Comparing base (f66da5e) to head (ff709e9).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6910      +/-   ##
============================================
+ Coverage     77.98%   78.06%   +0.08%     
- Complexity     6436     6466      +30     
============================================
  Files           736      738       +2     
  Lines         21499    21585      +86     
  Branches       4201     4220      +19     
============================================
+ Hits          16765    16850      +85     
  Misses         4063     4063              
- Partials        671      672       +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.

@DenizAltunkapan DenizAltunkapan merged commit 48ba1ae into TheAlgorithms:master Oct 23, 2025
6 checks passed
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.

[FEATURE REQUEST] Add LZ77 and LZ78 Algorithms to Compression Package

3 participants