3078 Commits

Author SHA1 Message Date
Adityaraj Solanki
48e02b3bac Add input validation for negative values in FibonacciSeries (#7177) 2025-12-18 17:09:55 +01:00
Saniya Mane
7d51c7f320 Add additional edge cases to GCD unit tests (#7174)
* 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>
2025-12-18 07:55:03 +00:00
Rajuri Likhitha
2911a7b52c ExtendedEuclideanAlgorithm (#7172)
* commit1

* Fix clang-format spacing in array declarations
2025-12-17 22:14:12 +01:00
NYAMATHABAD KOUSHIK SAI
4f293b33e5 [FEAT] Add Thin Lens formula for ray optics (#7170)
* [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>
2025-12-17 16:48:00 +01:00
dependabot[bot]
b76962d5ad chore(deps): bump com.puppycrawl.tools:checkstyle from 12.2.0 to 12.3.0 (#7167)
Bumps [com.puppycrawl.tools:checkstyle](https://github.com/checkstyle/checkstyle) from 12.2.0 to 12.3.0.
- [Release notes](https://github.com/checkstyle/checkstyle/releases)
- [Commits](https://github.com/checkstyle/checkstyle/compare/checkstyle-12.2.0...checkstyle-12.3.0)

---
updated-dependencies:
- dependency-name: com.puppycrawl.tools:checkstyle
  dependency-version: 12.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-16 17:53:29 +01:00
Taranjeet Singh Kalsi
d9f2ac8340 Added program to check Lucky number (#6962)
added program for lucky number
2025-12-14 10:29:14 +00:00
Muhammad Junaid Khalid
aa91451203 feat: Binary Tree to String algorithm added (Leetcode 606) (#6727)
* feat: BinaryTreeToString.java Added with tests

* fix: javadoc added to BinaryTreeToString

* fix: link to leetcode added
2025-12-14 10:14:00 +00:00
utkarsh patel
bccaf970ba Add Z-Algorithm for Linear-Time String Pattern Matching (#7124)
* Add Z-Algorithm (string pattern matching) with tests

* Add Z-Algorithm (string pattern matching) with tests

* Add Z-Algorithm (string pattern matching) with tests

* Fix checkstyle errors for ZAlgorithm

* Fix: clang-format and checkstyle compliance for ZAlgorithm
2025-12-14 10:08:18 +00:00
dependabot[bot]
746457ce15 chore(deps): bump actions/cache from 4 to 5 in /.github/workflows (#7162)
Bumps [actions/cache](https://github.com/actions/cache) from 4 to 5.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-13 00:29:17 +01:00
dependabot[bot]
a8bc9cc525 chore(deps-dev): bump org.mockito:mockito-core from 5.20.0 to 5.21.0 (#7154)
Bumps [org.mockito:mockito-core](https://github.com/mockito/mockito) from 5.20.0 to 5.21.0.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v5.20.0...v5.21.0)

---
updated-dependencies:
- dependency-name: org.mockito:mockito-core
  dependency-version: 5.21.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Deniz Altunkapan <deniz.altunkapan@outlook.com>
2025-12-10 10:33:35 +00:00
Lucas Horn
4f40206684 Add unit tests for graph algorithms (#7133) (#7156)
* 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>
2025-12-10 09:04:32 +00:00
codeahl
520151ab8e Add Big-O time and space complexity comments for sorting algorithms (#7155)
Add time and space complexity comments for specific sorting algorithms

Co-authored-by: Deniz Altunkapan <deniz.altunkapan@outlook.com>
2025-12-10 10:00:28 +01:00
dependabot[bot]
e7c3e1f773 chore(deps): bump com.mebigfatguy.fb-contrib:fb-contrib from 7.7.1 to 7.7.2 (#7153)
chore(deps): bump com.mebigfatguy.fb-contrib:fb-contrib

Bumps [com.mebigfatguy.fb-contrib:fb-contrib](https://github.com/mebigfatguy/fb-contrib) from 7.7.1 to 7.7.2.
- [Commits](https://github.com/mebigfatguy/fb-contrib/commits/v7.7.2)

---
updated-dependencies:
- dependency-name: com.mebigfatguy.fb-contrib:fb-contrib
  dependency-version: 7.7.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-09 09:43:17 +01:00
Daniel Sánchez Núñez
316def4ea6 Add Snell's Law refraction algorithm (#7150)
* 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
2025-12-07 12:18:55 +01:00
espinosadev
246162e5bd Fixed redundant boolean logic (#7151) 2025-12-05 16:45:25 +01:00
dependabot[bot]
bd7f269aa9 chore(deps): bump gitpod/workspace-java-21 from 2025-10-06-13-14-25 to 2025-11-14-10-05-32 (#7148)
chore(deps): bump gitpod/workspace-java-21

Bumps gitpod/workspace-java-21 from 2025-10-06-13-14-25 to 2025-11-14-10-05-32.

---
updated-dependencies:
- dependency-name: gitpod/workspace-java-21
  dependency-version: 2025-11-14-10-05-32
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-02 08:58:42 +00:00
dependabot[bot]
927fe1f87c chore(deps): bump com.puppycrawl.tools:checkstyle from 12.1.2 to 12.2.0 (#7147)
Bumps [com.puppycrawl.tools:checkstyle](https://github.com/checkstyle/checkstyle) from 12.1.2 to 12.2.0.
- [Release notes](https://github.com/checkstyle/checkstyle/releases)
- [Commits](https://github.com/checkstyle/checkstyle/compare/checkstyle-12.1.2...checkstyle-12.2.0)

---
updated-dependencies:
- dependency-name: com.puppycrawl.tools:checkstyle
  dependency-version: 12.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-02 09:54:59 +01:00
duvvuvenkataramana
8d2cdb27db feat: implement One-Time Pad cipher (#6941) (#7096)
* feat: implement One-Time Pad cipher (#6941)

* style: format OneTimePadCipher with clang-format
2025-12-01 20:17:32 +00:00
Shewale Gopal Sanjay
14c0b0844e Added threaded binary tree (#6995)
* Add One-Time Pad Cipher implementation in Java

* Add One-Time Pad Cipher implementation (fixed)

* Add ThreadedBinaryTree with in-order traversal and tests

* feat: add threaded binary tree implementation and tests

* fix: remove redundant null check for SpotBugs compliance
2025-12-01 20:13:14 +00:00
Taranjeet Singh Kalsi
ac6fef19dc Added program to check either number is Evil or Odious (#6958)
added program for evil number
2025-11-30 22:37:41 +00:00
Taranjeet Singh Kalsi
a9ba87c4b6 Added program to check Abundant number (#6961)
added program for abundant number
2025-11-28 08:51:28 +00:00
Sameer Prajapati
4c5525a2e0 feat: Added Gomory–Hu Tree (all-pairs min-cuts via n1 max-flows) (#6818)
* 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>
2025-11-28 08:47:53 +00:00
dependabot[bot]
f352f8111b chore(deps): bump com.mebigfatguy.fb-contrib:fb-contrib from 7.7.0 to 7.7.1 (#7144)
chore(deps): bump com.mebigfatguy.fb-contrib:fb-contrib

Bumps [com.mebigfatguy.fb-contrib:fb-contrib](https://github.com/mebigfatguy/fb-contrib) from 7.7.0 to 7.7.1.
- [Commits](https://github.com/mebigfatguy/fb-contrib/commits)

---
updated-dependencies:
- dependency-name: com.mebigfatguy.fb-contrib:fb-contrib
  dependency-version: 7.7.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-11-28 09:26:07 +01:00
Gokul45-45
d1ea306920 feat: add Valid Parentheses algorithm using Stack (#7117)
* feat: add Valid Parentheses algorithm using Stack

* fix: add missing ValidParentheses.java implementation

* fix: remove trailing spaces and add newline at EOF

* fix: remove misplaced ValidParentheses.java from root
2025-11-27 11:29:48 +00:00
Jayana Anjani Pavan Vardhan Naidu
e841d73837 Update Javadoc for perimeterIrregularPolygon method (#7141)
Fixed incorrect @return description in perimeterIrregularPolygon method javadoc. Changed "trapezoid" to "irregular polygon" to accurately reflect what the method calculates.
2025-11-27 12:25:52 +01:00
prasanth-30011
a14e1e3766 docs: improve javadoc for Combination class (#7126)
Updated class documentation to reflect that the class finds combinations instead of permutations.
2025-11-26 12:21:07 +01:00
dependabot[bot]
2c4bf3c7c8 chore(deps): bump com.github.spotbugs:spotbugs-maven-plugin from 4.9.8.1 to 4.9.8.2 (#7109)
chore(deps): bump com.github.spotbugs:spotbugs-maven-plugin

Bumps [com.github.spotbugs:spotbugs-maven-plugin](https://github.com/spotbugs/spotbugs-maven-plugin) from 4.9.8.1 to 4.9.8.2.
- [Release notes](https://github.com/spotbugs/spotbugs-maven-plugin/releases)
- [Commits](https://github.com/spotbugs/spotbugs-maven-plugin/compare/spotbugs-maven-plugin-4.9.8.1...spotbugs-maven-plugin-4.9.8.2)

---
updated-dependencies:
- dependency-name: com.github.spotbugs:spotbugs-maven-plugin
  dependency-version: 4.9.8.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-11-25 16:36:37 +01:00
Eswar Venkata Ram Charan Seeram
1c6026ecc6 fix: correct error message in surfaceAreaCylinder method (#7106) 2025-11-24 21:16:16 +01:00
Deniz Altunkapan
f693c44b53 fix: prevent duplicate auth header in GitHub Actions workflow (#7091) 2025-11-22 19:26:16 +02:00
KANAKALA SAI KIRAN
fa8ea8e614 Feature/centroid decomposition (#7086)
* 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
2025-11-22 09:44:34 +00:00
dependabot[bot]
e6c576c50a chore(deps): bump actions/checkout from 5 to 6 in /.github/workflows (#7084)
Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-11-20 19:44:44 +01:00
Piotr Idzik
fba6292ebc chore: pin infer to more recent hash (#7079)
* chore: pin infer to more recent hash

* chore: suppress new infer warnings
2025-11-19 19:31:32 +01:00
Deniz Altunkapan
e37a7ab6ce Update DIRECTORY.md (#7070)
Co-authored-by: alxkm <alxkm@users.noreply.github.com>
2025-11-19 18:25:09 +02:00
shreeya-g10
3519e396af backtracking: add unique permutation algorithm with test cases (#7078)
* Add unique permutation algorithm and test cases

* Fix: add braces for checkstyle

* Apply clang-format
2025-11-19 18:20:46 +02:00
dependabot[bot]
1c97ad8015 chore(deps): bump org.apache.commons:commons-lang3 from 3.19.0 to 3.20.0 (#7076)
Bumps org.apache.commons:commons-lang3 from 3.19.0 to 3.20.0.

---
updated-dependencies:
- dependency-name: org.apache.commons:commons-lang3
  dependency-version: 3.20.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-11-17 22:16:07 +01:00
GOPISETTI NAVADEEP
9f2b675f3e feat: add Sudoku Solver using Backtracking (#7073)
* feat: add Sudoku Solver using Backtracking (issue #6929)

* refactor: remove old Sudoku class from puzzlesandgames package

* Remove old Sudoku implementation and its test class
2025-11-17 09:54:20 +01:00
SeungHyeok Yun
cff5d3662e feat: add IndexedPriorityQueue implementation and tests (#7062)
* feat: add IndexedPriorityQueue implementation and tests

* mod : clang-format

* Fix Checkstyle naming for IndexedPriorityQueue tests

* Align IndexedPriorityQueue tests with Checkstyle and clang-format
2025-11-16 19:49:30 +01:00
GOPISETTI NAVADEEP
c6880c195d feat: add Sieve of Eratosthenes algorithm (#7071)
* 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
2025-11-16 12:00:21 +00:00
GOPISETTI NAVADEEP
93811614b8 feat: add Count Set Bits algorithm (#7072)
* feat: add Count Set Bits algorithm (issue #6931)

* fix: correct CountSetBits algorithm logic

* style: apply clang-format to CountSetBits files

* fix: correct test expectations for CountSetBits

* fix: correct test expectations for CountSetBits
2025-11-16 12:54:43 +01:00
Krishna
3979e824b7 Add Power of Four Check using bit manipulation (#7065)
* 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
2025-11-15 18:36:01 +01:00
Taranjeet Singh Kalsi
98eecb9f16 Added program to check Smith number (#6955)
added smith number program
2025-11-15 09:32:06 +00:00
Krishna
8a339ef2e2 Add Temperature Conversion Utility (#7066)
- Implements conversions between Celsius, Fahrenheit, and Kelvin
- Includes all 6 conversion methods
- Adds comprehensive unit tests with edge cases
- Fixes #6936
2025-11-15 10:22:36 +01:00
Deniz Altunkapan
a008cc2b08 Update DIRECTORY.md (#6809)
Co-authored-by: DenizAltunkapan <DenizAltunkapan@users.noreply.github.com>
2025-11-12 15:22:21 +02:00
dependabot[bot]
b709941eb6 chore(deps): bump com.puppycrawl.tools:checkstyle from 12.1.1 to 12.1.2 (#7063)
Bumps [com.puppycrawl.tools:checkstyle](https://github.com/checkstyle/checkstyle) from 12.1.1 to 12.1.2.
- [Release notes](https://github.com/checkstyle/checkstyle/releases)
- [Commits](https://github.com/checkstyle/checkstyle/compare/checkstyle-12.1.1...checkstyle-12.1.2)

---
updated-dependencies:
- dependency-name: com.puppycrawl.tools:checkstyle
  dependency-version: 12.1.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-11-11 22:30:27 +01:00
dependabot[bot]
0a55165692 chore(deps): bump com.mebigfatguy.fb-contrib:fb-contrib from 7.6.15 to 7.7.0 (#7060)
* chore(deps): bump com.mebigfatguy.fb-contrib:fb-contrib

Bumps [com.mebigfatguy.fb-contrib:fb-contrib](https://github.com/mebigfatguy/fb-contrib) from 7.6.15 to 7.7.0.
- [Commits](https://github.com/mebigfatguy/fb-contrib/commits/v7.7.0)

---
updated-dependencies:
- dependency-name: com.mebigfatguy.fb-contrib:fb-contrib
  dependency-version: 7.7.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix: suppress new warnings

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: vil02 <65706193+vil02@users.noreply.github.com>
2025-11-11 13:03:51 +01:00
PRINCE PATEL
2588af0205 fix: Correct typo in ExponentialSearch filename (#7056) 2025-11-07 11:32:18 +01:00
Priyanshu Kumar Singh
4951fb9ce2 [FEAT] Add Kinematics (SUVAT) equations (#7053)
[FEAT] Add SUVAT equation for motion

Co-authored-by: Priyanshu1303d <priyanshu130d@gmail.com>
2025-11-06 18:41:39 +01:00
Lê Nam Khánh
5a68ba9399 chore: fix typos in some files (#7052)
Fix typos in some files
2025-11-06 12:40:34 +02:00
Arzoo1701
d126fd59f7 Add Trapping Rainwater problem implementation (Two Pointer Approach) (#6990)
* 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>
2025-11-05 18:41:08 +01:00
Lê Nam Khánh
d28fee9665 chore: fix typos in src/main/java/com/thealgorithms/dynamicprogramming/BoundaryFill.java (#7049)
Fix typos in src/main/java/com/thealgorithms/dynamicprogramming/BoundaryFill.java
2025-11-05 15:53:18 +00:00