Ahmed Allam
8e30bcbb02
refactor: clean up duplicate algorithm implementations to reduce maintenance overhead ( #7256 )
...
refactor: remove duplicate algorithm implementations
Removed the following duplicate implementations:
- searches/PerfectBinarySearch.java (duplicate of IterativeBinarySearch)
- searches/SortOrderAgnosticBinarySearch.java (duplicate of OrderAgnosticBinarySearch)
- strings/LongestPalindromicSubstring.java (duplicate of dynamicprogramming version)
- strings/ValidParentheses.java (duplicate of stacks version)
- others/cn/HammingDistance.java (duplicate - strings version handles text)
- others/NewManShanksPrimeTest.java (orphan test in wrong package)
Updated DIRECTORY.md to reflect the changes.
Fixes #7253
Co-authored-by: Ahmed Allam <60698204+AllamF5J@users.noreply.github.com >
2026-02-03 21:32:37 +01:00
dependabot[bot]
c6703d337e
chore(deps-dev): bump org.apache.maven.plugins:maven-compiler-plugin from 3.14.1 to 3.15.0 ( #7254 )
...
chore(deps-dev): bump org.apache.maven.plugins:maven-compiler-plugin
Bumps [org.apache.maven.plugins:maven-compiler-plugin](https://github.com/apache/maven-compiler-plugin ) from 3.14.1 to 3.15.0.
- [Release notes](https://github.com/apache/maven-compiler-plugin/releases )
- [Commits](https://github.com/apache/maven-compiler-plugin/compare/maven-compiler-plugin-3.14.1...maven-compiler-plugin-3.15.0 )
---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-compiler-plugin
dependency-version: 3.15.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>
2026-02-03 10:55:55 +01:00
Ruturaj Jadhav
3e36833bf4
add Subarray Sum Equals K using prefix sum ( #7252 )
...
Co-authored-by: Deniz Altunkapan <deniz.altunkapan@outlook.com >
2026-02-01 16:26:57 +01:00
Divyansh Saxena
dfaa495639
Refactor KMP and RabinKarp: Improve Reusability and Test Coverage ( #7250 )
...
* first commit
* Running KMPTest and RabinKarpTest with fixed formatting
* now build failed error resolved
* now build failed error resolved 2
---------
Co-authored-by: Divyansh Saxena <divyanshsaxena@gmail.com >
Co-authored-by: Deniz Altunkapan <deniz.altunkapan@outlook.com >
2026-02-01 14:51:13 +00:00
dependabot[bot]
f3fd9ca385
chore(deps): bump com.puppycrawl.tools:checkstyle from 13.0.0 to 13.1.0 ( #7251 )
...
Bumps [com.puppycrawl.tools:checkstyle](https://github.com/checkstyle/checkstyle ) from 13.0.0 to 13.1.0.
- [Release notes](https://github.com/checkstyle/checkstyle/releases )
- [Commits](https://github.com/checkstyle/checkstyle/compare/checkstyle-13.0.0...checkstyle-13.1.0 )
---
updated-dependencies:
- dependency-name: com.puppycrawl.tools:checkstyle
dependency-version: 13.1.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>
2026-01-31 19:32:08 +01:00
Pranav Ghorpade
11eec78770
docs: Add comprehensive documentation to BinarySearch algorithm ( #7245 )
...
* docs: Add comprehensive documentation to BinarySearch algorithm
- Added detailed JavaDoc with @param, @return, @throws tags
- Included step-by-step algorithm walkthrough example
- Added inline comments explaining each code section
- Documented time and space complexity analysis
- Provided concrete usage examples with expected outputs
- Explained edge cases and overflow prevention technique
* style: Apply proper Java formatting to BinarySearch
- Fixed line length to meet style guidelines
- Applied proper JavaDoc formatting
- Corrected indentation and spacing
- Ensured compliance with project formatting standards
* fix: correct Javadoc formatting and add missing newline at EOF
- Fix Javadoc structure with proper tag ordering (description before @params)
- Remove incorrect @throws tag (method returns -1, doesn't throw)
- Format algorithm steps as proper HTML ordered list
- Move complexity analysis before @param tags
- Add missing newline at end of file
- Fix example code to use instance method call
2026-01-30 20:01:10 +01:00
Chahat Sandhu
dc3d64f51d
feat: add Difference Array algorithm implementation and tests ( #7244 )
2026-01-27 22:29:05 +01:00
dependabot[bot]
2ea3873b9f
chore(deps-dev): bump org.assertj:assertj-core from 3.27.6 to 3.27.7 ( #7243 )
...
Bumps [org.assertj:assertj-core](https://github.com/assertj/assertj ) from 3.27.6 to 3.27.7.
- [Release notes](https://github.com/assertj/assertj/releases )
- [Commits](https://github.com/assertj/assertj/compare/assertj-build-3.27.6...assertj-build-3.27.7 )
---
updated-dependencies:
- dependency-name: org.assertj:assertj-core
dependency-version: 3.27.7
dependency-type: direct:development
...
Signed-off-by: dependabot[bot] <support@github.com >
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-01-27 00:46:45 +01:00
Deniz Altunkapan
a3efc108b8
Docs/remove readme korean readme file ( #7242 )
...
* fix: prevent duplicate auth header in GitHub Actions workflow
* chore: remove Korean README file
2026-01-26 22:33:04 +01:00
Piotr Idzik
6fdf2db298
style: resolve some of the UTAO_JUNIT_ASSERTION_ODDITIES_USE_ASSERT_EQUALS warnings ( #7240 )
2026-01-25 12:44:41 +01:00
Piotr Idzik
0b0cefe9f9
style: include UTAO_JUNIT_ASSERTION_ODDITIES_ACTUAL_CONSTANT ( #7239 )
2026-01-24 14:16:48 +01:00
Piotr Idzik
1a7f8fe79e
style: include UTAO_JUNIT_ASSERTION_ODDITIES_IMPOSSIBLE_NULL ( #7238 )
2026-01-23 09:39:22 +01:00
Mohammed Vijahath
a7eeee2b5b
Fix: NumberFormatException with non-ASCII Unicode digits in MyAtoi ( #7231 )
...
Fix myAtoi handling of non-ASCII Unicode digits
2026-01-22 17:09:23 +01:00
Piotr Idzik
0f9139dc42
style: include UTAO_JUNIT_ASSERTION_ODDITIES_USE_ASSERT_NOT_EQUALS ( #7229 )
2026-01-22 09:24:45 +01:00
Piotr Idzik
0e8291e669
style: include UTAO_JUNIT_ASSERTION_ODDITIES_USE_ASSERT_NOT_NULL ( #7226 )
2026-01-21 10:55:09 +01:00
Piotr Idzik
1b014a2ea4
style: include UTAO_JUNIT_ASSERTION_ODDITIES_USE_ASSERT_NULL ( #7225 )
2026-01-20 22:02:10 +01:00
dependabot[bot]
ba5ccbe0c7
chore(deps-dev): bump com.mebigfatguy.fb-contrib:fb-contrib from 7.7.3 to 7.7.4 ( #7222 )
...
* chore(deps-dev): bump com.mebigfatguy.fb-contrib:fb-contrib
Bumps [com.mebigfatguy.fb-contrib:fb-contrib](https://github.com/mebigfatguy/fb-contrib ) from 7.7.3 to 7.7.4.
- [Commits](https://github.com/mebigfatguy/fb-contrib/compare/v7.7.3...v7.7.4 )
---
updated-dependencies:
- dependency-name: com.mebigfatguy.fb-contrib:fb-contrib
dependency-version: 7.7.4
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com >
* fix: supporess 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 >
2026-01-20 12:38:12 +00:00
Gopesh Pandey
7339b9dfe9
Add distance between two points algorithm ( #7218 )
...
* Add distance between two points algorithm
* Create DistanceBetweenTwoPointsTest.java
* DistanceBetweenTwoPoints.java
* Fix test file package and project structure
* Delete src/test/java/com/thealgorithms/DistanceBetweenTwoPointsTest.java
* Apply clang-format compliant formatting
* Apply clang-format
---------
Co-authored-by: a <19151554+alxkm@users.noreply.github.com >
2026-01-19 21:36:03 +01:00
Chahat Sandhu
109ed2e497
feat: Add Prefix Sum category with 1D and 2D implementations ( #7220 )
...
Co-authored-by: Deniz Altunkapan <deniz.altunkapan@outlook.com >
2026-01-19 10:15:59 +00:00
Chahat Sandhu
1b9373e71a
feat: add Bell Numbers algorithm using Aitken's Array ( #7219 )
...
* feat: added Bell Numbers algorithm using Aitken's Array
* style: applied clang-format fixes
2026-01-19 09:59:58 +00:00
SwaatiR
79cdb98193
Add input validation and clarify sorted array requirement in Binary Search ( #7216 )
...
Added input validation and clarify sorted array rrequirement in Binary Search
2026-01-18 16:01:01 +00:00
Chahat Sandhu
48f6322b38
docs: add Javadoc to FibonacciSeries ( #7215 )
...
* docs: add Javadoc to FibonacciSeries
* fix: make small adjustment
---------
Co-authored-by: Deniz Altunkapan <deniz.altunkapan@outlook.com >
2026-01-17 18:22:11 +00:00
SwaatiR
782d0755d5
Improve documentation for Linear Search algorithm ( #7214 )
2026-01-17 19:18:54 +01:00
Ahmed Allam
fd0bcb79e6
Add Middle of Linked List (Slow/Fast Pointers) ( #7212 )
...
* feat: implement Smooth Sort algorithm with detailed JavaDoc and test class
* style: format LEONARDO array for improved readability with clang-format
* feat: add MiddleOfLinkedList class and corresponding test cases
* docs: update documentation for MiddleOfLinkedList class
* test: refactor MiddleOfLinkedListTest to improve readability and assertions
* test: refactor MiddleOfLinkedListTest for improved null safety and readability
---------
Co-authored-by: Ahmed Allam <60698204+AllamF5J@users.noreply.github.com >
2026-01-16 12:33:29 +01:00
dependabot[bot]
babc762478
chore(deps-dev): bump com.mebigfatguy.fb-contrib:fb-contrib from 7.7.2 to 7.7.3 ( #7211 )
...
chore(deps-dev): bump com.mebigfatguy.fb-contrib:fb-contrib
Bumps [com.mebigfatguy.fb-contrib:fb-contrib](https://github.com/mebigfatguy/fb-contrib ) from 7.7.2 to 7.7.3.
- [Commits](https://github.com/mebigfatguy/fb-contrib/compare/v7.7.2...v7.7.3 )
---
updated-dependencies:
- dependency-name: com.mebigfatguy.fb-contrib:fb-contrib
dependency-version: 7.7.3
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>
2026-01-15 23:24:40 +01:00
Ahmed Allam
66f76eb3d9
Add RotatedBinarySearch (search in rotated sorted array) ( #7202 )
...
* 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 >
2026-01-14 10:59:25 +01:00
Ahmed Allam
7148661e44
Feat/tournament sort ( #7201 )
...
* 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 >
2026-01-13 23:04:14 +01:00
asmitha-16
bdda4fa6b4
Handle negative input in perfect square checks ( #7207 )
2026-01-13 22:39:41 +01:00
Tarunj Gupta
1644db2a34
Add Count Nice Subarrays sliding using window algorithm ( #7206 )
...
* Add Count Nice Subarrays sliding window algorithm
* Add detailed comments and reference to CountNiceSubarrays
* Fix clang-format issues in CountNiceSubarrays
* Added extra edge cases
* changes made
2026-01-10 16:32:19 +01:00
Ahmed Allam
fe6066b332
Add SmoothSort (Dijkstra’s adaptive in-place heapsort variant) ( #7200 )
...
* 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 >
2026-01-09 12:36:46 +01:00
dependabot[bot]
ca4bebcbd5
chore(deps): bump peter-evans/create-pull-request from 7 to 8 in /.github/workflows ( #7199 )
...
chore(deps): bump peter-evans/create-pull-request in /.github/workflows
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request ) from 7 to 8.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases )
- [Commits](https://github.com/peter-evans/create-pull-request/compare/v7...v8 )
---
updated-dependencies:
- dependency-name: peter-evans/create-pull-request
dependency-version: '8'
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>
2026-01-08 09:56:14 +01:00
Rajesh Reddy
938d06abb5
docs: clarify hash map vs HashMap terminology ( #7195 )
2026-01-07 12:49:51 +01:00
dependabot[bot]
404e1404aa
chore(deps): bump org.junit:junit-bom from 6.0.1 to 6.0.2 ( #7194 )
...
Bumps [org.junit:junit-bom](https://github.com/junit-team/junit-framework ) from 6.0.1 to 6.0.2.
- [Release notes](https://github.com/junit-team/junit-framework/releases )
- [Commits](https://github.com/junit-team/junit-framework/compare/r6.0.1...r6.0.2 )
---
updated-dependencies:
- dependency-name: org.junit:junit-bom
dependency-version: 6.0.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>
2026-01-06 22:38:42 +01:00
dependabot[bot]
c06c0f03e3
chore(deps): bump com.puppycrawl.tools:checkstyle from 12.3.1 to 13.0.0 ( #7193 )
...
Bumps [com.puppycrawl.tools:checkstyle](https://github.com/checkstyle/checkstyle ) from 12.3.1 to 13.0.0.
- [Release notes](https://github.com/checkstyle/checkstyle/releases )
- [Commits](https://github.com/checkstyle/checkstyle/compare/checkstyle-12.3.1...checkstyle-13.0.0 )
---
updated-dependencies:
- dependency-name: com.puppycrawl.tools:checkstyle
dependency-version: 13.0.0
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>
2026-01-05 22:50:29 +01:00
Giridharan S
24389c06a2
Add detailed JavaDoc for AllPathsFromSourceToTarget algorithm ( #7192 )
...
Add detailed JavaDoc for AllPathsFromSourceToTarget
2026-01-05 17:10:24 +01:00
dependabot[bot]
e945f16224
chore(deps): bump com.puppycrawl.tools:checkstyle from 12.3.0 to 12.3.1 ( #7188 )
...
Bumps [com.puppycrawl.tools:checkstyle](https://github.com/checkstyle/checkstyle ) from 12.3.0 to 12.3.1.
- [Release notes](https://github.com/checkstyle/checkstyle/releases )
- [Commits](https://github.com/checkstyle/checkstyle/compare/checkstyle-12.3.0...checkstyle-12.3.1 )
---
updated-dependencies:
- dependency-name: com.puppycrawl.tools:checkstyle
dependency-version: 12.3.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>
2026-01-01 18:23:45 +01:00
Deniz Altunkapan
0eda2a1db8
Add test requirement to pull request template ( #7185 )
...
* Add checklist item for test class inclusion
* Update pull request template for algorithm tests
2025-12-29 21:55:23 +01:00
Deniz Altunkapan
6149ec7fed
Update DIRECTORY.md ( #7093 )
...
Co-authored-by: DenizAltunkapan <DenizAltunkapan@users.noreply.github.com >
2025-12-29 17:06:23 +02:00
Patil Arpita
35556fe1f1
Added 0/1 Knapsack Algorithm using Dynamic Programming in Java ( #6789 )
...
* Added 0/1 Knapsack Algorithm using Dynamic Programming in Java
* Fix Checkstyle whitespace issues in Knapsack.java
* Formatted Knapsack.java to pass linter and added 0/1 Knapsack algorithm
* Formatted Knapsack.java to pass linter and added 0/1 Knapsack algorithm
* Formatted Knapsack.java to pass linter and added 0/1 Knapsack algorithm
* Formatted Knapsack.java to pass linter and added 0/1 Knapsack algorithm
---------
Co-authored-by: Deniz Altunkapan <deniz.altunkapan@outlook.com >
2025-12-29 14:27:31 +01:00
Daniel Sánchez Núñez
d382e656f2
Adding method to check wether a matrix is stochastic ( #7184 )
...
* 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.
2025-12-28 10:53:12 +01:00
NYAMATHABAD KOUSHIK SAI
51335cc18a
Add Immutable HashMap implementation ( #7183 )
...
* Add immutable HashMap implementation
* Add immutable HashMap implementation
* Applied clang-format
---------
Co-authored-by: Koushik Sai <nyamathabadkoushik@gmail.com >
2025-12-27 16:55:23 +00:00
NYAMATHABAD KOUSHIK SAI
2707da25e3
Add recursive factorial implementation with tests ( #7178 )
...
* Add recursive factorial implementation with tests
* [STYLE] Apply clang-format
* Move recursive factorial to recursion package and remove duplicate
* Move recursive factorial to recursion package and remove duplicate
* Apply clang-format to factorial recursion tests
* Apply clang-format to factorial recursion tests
---------
Co-authored-by: Koushik Sai <nyamathabadkoushik@gmail.com >
Co-authored-by: Deniz Altunkapan <deniz.altunkapan@outlook.com >
2025-12-22 20:15:50 +00:00
HxCodes
1eb0d61730
Improve documentation and inline comments for QuickSort algorithm ( #7182 )
...
* Improve QuickSort documentation with detailed comments and explanations
* Format QuickSort documentation and fix JavaDoc layout
2025-12-21 16:33:25 +01:00
Gopal Gupta
bb334881e9
Implement LengthOfLastWord algorithm and add JUnit tests ( #7057 )
...
* Implement LengthOfLastWord algorithm in strings package
* Add JUnit tests for LengthOfLastWord algorithm
* style: fix import order and spacing for clang-format
2025-12-20 13:42:34 +00:00
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