mirror of
https://github.com/TheAlgorithms/Java.git
synced 2026-03-13 08:40:43 +08:00
15695c6e549c1cfb7af8e895de3f566d20f92ca6
* Fix MiniMaxAlgorithm setScores bug and add comprehensive tests - Fix bug in setScores method where scores.length % 1 == 0 always returned true - Add isPowerOfTwo helper method to properly validate array length - Add comprehensive unit tests covering edge cases and algorithm correctness - Tests include validation for power of 2 check, minimax logic, and error handling Fixes issue with incorrect validation logic in MiniMaxAlgorithm.setScores() * Fix Checkstyle violations and improve setScores validation - Replace star imports with explicit imports in test file - Remove trailing whitespaces from all lines - Add proper file ending newline - Improve setScores method to handle edge cases properly - Use direct bit manipulation for power-of-2 check as suggested - Ensure error message is printed and scores remain unchanged for invalid input All Checkstyle violations resolved and tests pass successfully. * Add missing newline at end of MiniMaxAlgorithmTest.java - Fix Checkstyle violation: NewlineAtEndOfFile - Ensure file ends with proper newline character - All tests continue to pass successfully * Fix PMD violation by utilizing isPowerOfTwo method - Replace inline bit manipulation with isPowerOfTwo method call - Resolves PMD UnusedPrivateMethod violation - Maintains same validation logic and error handling - All tests continue to pass successfully * test: improve MiniMaxAlgorithm test coverage for CodeCov - Add comprehensive test cases for isPowerOfTwo function edge cases - Test setScores method with various invalid array lengths (0, 3, 5, 6, 7, 9, 10, 15) - Add tests for large valid powers of 2 (up to 64 elements) - Ensure complete coverage of error handling branches - Increase test count from 14 to 19 tests - Fix partial coverage issues identified in CodeCov report Resolves CodeCov coverage gaps in MiniMaxAlgorithm.java * Fix checkstyle errors * Fix checkstyle errors --------- Co-authored-by: ssaha <ssaha@wiley.com> Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
The Algorithms - Java
You can run and edit the algorithms, or contribute to them using Gitpod.io (a free online development environment) with a single click.
All algorithms are implemented in Java (for educational purposes)
These implementations are intended for learning purposes. As such, they may be less efficient than the Java standard library.
Contribution Guidelines
Please read our Contribution Guidelines before you contribute to this project.
Algorithms
Our directory has the full list of applications.
Description
All Algorithms implemented in Java
algorithmalgorithm-challengesalgorithmsalgorithms-datastructuresdata-structureshacktoberfestjavasearchsortsorting-algorithms
Readme
MIT
172 MiB
Languages
Java
100%