* 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>
* 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
* feat: add Sudoku Solver using Backtracking (issue #6929)
* refactor: remove old Sudoku class from puzzlesandgames package
* Remove old Sudoku implementation and its test class
* feat: add Sieve of Eratosthenes algorithm
- Implement Sieve of Eratosthenes for finding prime numbers up to n
- Add comprehensive unit tests with edge cases
- Include JavaDoc documentation
- Time complexity: O(n log log n)
- Space complexity: O(n)
Resolves#6939
* fix: remove trailing spaces
* fix: apply clang-format
* Add Power of Four Check using bit manipulation
- Implements isPowerOfFour method using bit manipulation
- Checks if number is power of two and has bit at even position
- Includes comprehensive unit tests
- Fixes#6940
* Fix code formatting in PowerOfFourTest
* Move PowerOfFour classes to maths package
* Fix package declaration in PowerOfFourTest
* Fix code formatting in PowerOfFourTest
* Remove redundant import from PowerOfFourTest
* Remove unrelated file
- Implements conversions between Celsius, Fahrenheit, and Kelvin
- Includes all 6 conversion methods
- Adds comprehensive unit tests with edge cases
- Fixes#6936
* Add Trapping Rainwater problem implementation (Two Pointer Approach)
* Add Wikipedia reference link for Trapping Rainwater problem
* fix: format TrappingRainwater.java for CI check
* fix: add package and resolve checkstyle errors for TrappingRainwater.java
* fix: declare TrappingRainwater as final to pass Checkstyle
* Add test cases for TrappingRainwater algorithm
* Add test cases for TrappingRainwater algorithm
* Move TrappingRainwater algorithm to stacks package
* Fix: Move TrappingRainwater to stacks and normalize newline in JugglerSequence
* Fix: Normalize newline in JugglerSequence to ensure test consistency
* Fix: Normalize newline in JugglerSequence and remove return statement
* Add JaCoCo plugin for code coverage reporting
* Revert pom.xml to original version from master
* Fix: Revert the pom.xml file
---------
Co-authored-by: Deniz Altunkapan <deniz.altunkapan@outlook.com>
* add CombinationSum and test
* Format array and list literals in CombinationSumTest
* Fix sorting comparator in CombinationSumTest
* Refactor CombinationSum for better handling and clarity
Updated combinationSum method to handle null or empty candidates and improved variable naming for clarity.
* Fix sorting comparator in CombinationSumTest
* Update CombinationSumTest.java
* Fix sorting comparator for list of integers
* Fix formatting issues in CombinationSum class
* Change CombinationSum class to final
* Refactor norm method to accept Iterable instead of List
* Remove unnecessary whitespace in CombinationSumTest
* Added LU decomposition algorthm
* Added LU decomposition algorthim
* Added LU decomposition algorthim
* Added LU decomposition algorthim
* Added LU decomposition algorthim
* Added LU decomposition algorthim
* Added LU decomposition algorthim
* Added LU decomposition algorthim
* Added LU decomposition algorthim
* feat: Add BitRotate utility for circular bit rotations
* feat: Add BitRotate utility for circular bit rotations
* feat: Add BitRotate utility for circular bit rotations
* fix: Remove trailing spaces and add newline at EOF
---------
Co-authored-by: Yajunesh M R <yajunesh@Yajuneshs-MacBook-Pro.local>
* feat(geometry): add Bentley-Ottmann line segment intersection algorithm
- Implement sweep-line algorithm for finding all intersection points
- Time complexity: O((n + k) log n) where n is segments, k is intersections
- Uses event queue (PriorityQueue) and status structure (TreeSet)
- Handles vertical/horizontal segments, collinear overlaps, and touching endpoints
- Includes comprehensive Javadoc with examples and references
* test(geometry): add comprehensive tests for Bentley-Ottmann algorithm
- 19 test cases covering typical, edge, and degenerate cases
- Tests include: single/multiple intersections, parallel segments, grid patterns
- Performance test with 100 random segments
- All tests validate correctness of intersection detection
* style(geometry): fix code style
* test(geometry): Achieve 100% test coverage for BentleyOttmann
* style(geometry): fix code style again
* fix: correct import order in BentleyOttmann
* fix(geometry): Resolve SpotBugs and PMD static analysis warnings
* Reorder import statements in BentleyOttmannTest
---------
Co-authored-by: Deniz Altunkapan <deniz.altunkapan@outlook.com>
* Fix ConvexHull to return points in counter-clockwise order
- Add sortCounterClockwise method to ensure CCW ordering
- Start from bottom-most, left-most point for deterministic results
- Fix issue where unordered HashSet broke downstream algorithms
- Add comprehensive tests with CCW order verification
* test(geometry): Achieve 100% test coverage for ConvexHull
* Adding DampedOscillator code
* Adding one more test case
* Adding one more test case
* Adding one more test case
* Fixing build issues.
* Fixing build issues.