Skip to content

Add RandomizedMatrixVerifier and test class #6305

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

krishnamitra03
Copy link

New Feature: Randomized Matrix Equality Verifier
This pull request introduces a new utility class called RandomizedMatrixVerifier in the matrix package.
It provides an efficient method areMatricesEqual(int[][] a, int[][] b) that determines whether two matrices are equal using randomized hashing with prime coefficients.
This approach ensures performance and robustness, especially for large matrices.

Tests Added:-
A corresponding test class RandomizedMatrixVerifierTest is added under src/test/java/com/thealgorithms/matrix/.
It includes two unit tests using JUnit 5:
✅ Verifies equality for identical matrices
❌ Verifies inequality for different matrices
Both test cases pass successfully using the Maven test runner.

Build & Code Coverage:-
The project builds cleanly with Java 21 and Maven 3.9.10
Tests executed via mvn -Dtest=RandomizedMatrixVerifierTest test
Code coverage verified using JaCoCo, confirming the new code is tested

Code Quality & Structure:-
Follows the existing file structure and naming conventions of the repository
Code is clean, well-commented, and adheres to contribution guidelines
No breaking changes introduced to existing functionality

About This Contribution:-
This is my first contribution to the TheAlgorithms/Java repository
I’m currently learning open-source contribution and Java best practices.

Feedback and suggestions are warmly welcome!!!

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 95.65217% with 1 line in your changes missing coverage. Please review.

Project coverage is 74.18%. Comparing base (ae71861) to head (a9fdfe5).

Files with missing lines Patch % Lines
...thealgorithms/matrix/RandomizedMatrixVerifier.java 95.65% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6305      +/-   ##
============================================
+ Coverage     74.16%   74.18%   +0.02%     
- Complexity     5362     5372      +10     
============================================
  Files           678      679       +1     
  Lines         18686    18709      +23     
  Branches       3625     3634       +9     
============================================
+ Hits          13858    13880      +22     
- Misses         4273     4274       +1     
  Partials        555      555              

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

3 participants