Skip to content

Conversation

@Microindole
Copy link
Contributor

Description

This PR adds two fundamental data transformation algorithms to the compression category. These algorithms are commonly used as pre-processing steps in modern lossless compression pipelines:

  • BWT (Burrows-Wheeler Transform)
  • MTF (Move-to-Front)

In line with the repository's goal, these implementations are intended for learning purposes, demonstrating key components used in formats like bzip2.

This contribution adds the following new files:

  • src/main/java/com/thealgorithms/compression/BurrowsWheelerTransform.java
  • src/main/java/com/thealgorithms/compression/MoveToFront.java
  • src/test/java/com/thealgorithms/compression/BurrowsWheelerTransformTest.java
  • src/test/java/com/thealgorithms/compression/MoveToFrontTest.java

Both implementations are accompanied by comprehensive JUnit tests to ensure correctness and handle edge cases (e.g., empty inputs, symbols not in alphabet).

Related Issue

Closes #6925

Checklist

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

@codecov-commenter
Copy link

codecov-commenter commented Oct 25, 2025

Codecov Report

❌ Patch coverage is 98.70130% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 78.13%. Comparing base (48ba1ae) to head (b2d8e7c).

Files with missing lines Patch % Lines
...lgorithms/compression/BurrowsWheelerTransform.java 98.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6926      +/-   ##
============================================
+ Coverage     78.05%   78.13%   +0.07%     
- Complexity     6466     6496      +30     
============================================
  Files           738      740       +2     
  Lines         21585    21662      +77     
  Branches       4220     4235      +15     
============================================
+ Hits          16849    16925      +76     
+ Misses         4064     4063       -1     
- Partials        672      674       +2     

☔ 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.

Copy link
Member

@DenizAltunkapan DenizAltunkapan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the contribution @Microindole

@DenizAltunkapan DenizAltunkapan merged commit ab65ac6 into TheAlgorithms:master Oct 25, 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] Proposal to add BWT (Burrows-Wheeler Transform) and MTF (Move-to-Front)

3 participants