* feat: implement Smooth Sort algorithm with detailed JavaDoc and test class
* style: format LEONARDO array for improved readability with clang-format
* feat(sorts): add TournamentSort (winner-tree)
* test: add unit test for null array handling in TournamentSort
* feat(search): add rotated binary search
* test: add unit test for handling middle element in right sorted half of rotated array
---------
Co-authored-by: Ahmed Allam <60698204+AllamF5J@users.noreply.github.com>
* feat: implement Smooth Sort algorithm with detailed JavaDoc and test class
* style: format LEONARDO array for improved readability with clang-format
* feat(sorts): add TournamentSort (winner-tree)
* test: add unit test for null array handling in TournamentSort
---------
Co-authored-by: Ahmed Allam <60698204+AllamF5J@users.noreply.github.com>
Co-authored-by: Deniz Altunkapan <deniz.altunkapan@outlook.com>
Co-authored-by: Oleksandr Klymenko <19151554+alxkm@users.noreply.github.com>
* feat: implement Smooth Sort algorithm with detailed JavaDoc and test class
* style: format LEONARDO array for improved readability with clang-format
---------
Co-authored-by: Ahmed Allam <60698204+AllamF5J@users.noreply.github.com>
* Add StochasticMatrix utility class
This class provides methods to check if a matrix is row-stochastic or column-stochastic, ensuring all elements are non-negative and the sums of rows or columns equal 1.
* Change package from maths to matrix
Updated package declaration for StochasticMatrix class.
* Change package declaration in StochasticMatrixTest
* Delete src/test/java/com/thealgorithms/StochasticMatrixTest.java
* Refactor matrix initialization for test cases
* Fix formatting of matrix initialization in tests
* Remove unnecessary newline in StochasticMatrix
* Add import statement for JUnit in StochasticMatrixTest
* Add additional assertions to StochasticMatrixTest
* Clean up import statements in StochasticMatrixTest
Removed unused import statements for cleaner code.
* Reorder import statements in StochasticMatrixTest
* Remove unused import assertThrows from StochasticMatrixTest
Removed unused import for assertThrows.
* Implement LengthOfLastWord algorithm in strings package
* Add JUnit tests for LengthOfLastWord algorithm
* style: fix import order and spacing for clang-format
* Add additional edge cases to GCD unit tests
* Rename GCD test methods and add descriptive names
* Fix formatting in GCD tests
---------
Co-authored-by: Deniz Altunkapan <deniz.altunkapan@outlook.com>
* [FEAT] Add Thin Lens formula for ray optics
* [CI] Re-run clang-format checks
* [CI] Re-run checks after rebase
* [STYLE] Apply clang-format to ThinLensTest
---------
Co-authored-by: Koushik Sai <nyamathabadkoushik@gmail.com>
* Add unit tests for graph algorithms (BFS, DFS, Dijkstra, Bellman-Ford) #7133
- Created BellmanFordTest.java with 10 test methods covering various graph scenarios
- Created ConnectedComponentTest.java with 15 test methods for DFS-based component counting
- Enhanced MatrixGraphsTest.java with additional BFS/DFS test cases
- Enhanced DijkstraAlgorithmTest.java with comprehensive shortest path tests
Fixes#7133
* fix: format files using clang
* fix: removing my changes on pull_request_template
---------
Co-authored-by: prashantdubeypng <vinoddubey6059@gmail.com>
* Add Snell's Law implementation for refraction angle
* Add tests for Snell's Law calculations
* Update documentation with reference link to Snell's Law
Added a reference link to Snell's Law in the documentation.
* Prevent instantiation of SnellLaw class
Make SnellLaw class non-instantiable by adding a private constructor.
* Rename SnellsLawTest to SnellLawTest
* Refactor SnellLawTest for clarity and accuracy
* Rename SnellsLaw.java to SnellLaw.java
* Refactor SnellLawTest with additional assertions
* Refactor SnellLaw class constructor and error handling
Refactor SnellLaw constructor and error message formatting.
* Fix missing newline at end of SnellLawTest.java
Ensure that the SnellLawTest class has a newline at the end of the file.
* Simplify assertions in SnellLawTest
* Simplify exception throwing for total internal reflection
* Add Gomory–Hu Tree (all-pairs min-cuts via n1 max-flows)
* Stabilize Monte Carlo integration with antithetic variates to reduce variance
* Fix Checkstyle in GomoryHuTreeTest: remove inner assignments, add braces, split declarations
* SpotBugs: use RandomGenerator interface in test helper
---------
Co-authored-by: Deniz Altunkapan <deniz.altunkapan@outlook.com>
Fixed incorrect @return description in perimeterIrregularPolygon method javadoc. Changed "trapezoid" to "irregular polygon" to accurately reflect what the method calculates.
* feat: Add Centroid Decomposition for trees (#7054)
- Implement CentroidDecomposition with O(N log N) construction
- Add CentroidTree class with parent tracking and query methods
- Include buildFromEdges helper for easy tree construction
- Add comprehensive test suite with 20+ test cases
- Cover edge cases, validation, and various tree structures
Closes#7054
* feat: Add Centroid Decomposition for trees (#7054)
- Implement CentroidDecomposition with O(N log N) construction
- Add CentroidTree class with parent tracking and query methods
- Include buildFromEdges helper for easy tree construction
- Add comprehensive test suite with 20+ test cases
- Cover edge cases, validation, and various tree structures
Closes#7054
* fix: Remove trailing whitespace from CentroidDecompositionTest
* fix: Remove trailing whitespace and add newlines at end of files
* fix: Format code to comply with clang-format and checkstyle requirements
* style: Fix lambda formatting in test assertions
- Change single-line lambdas to multi-line format
- Align with repository code style guidelines
* style: Apply clang-format to match repository style guide
- Format code according to .clang-format configuration
- Use single-line lambdas as allowed by AllowShortLambdasOnASingleLine: All
- Apply 4-space indentation
- Ensure proper line endings