Commit Graph

3114 Commits

Author SHA1 Message Date
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
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