Commit Graph

3138 Commits

Author SHA1 Message Date
Piotr Idzik
109df1f398 style: include SUA_SUSPICIOUS_UNINITIALIZED_ARRAY (#7285) 2026-02-21 16:27:13 +01:00
Mohan E
2d443a9991 Add time and space complexity documentation to LongestNonRepetitiveSubstring (#7284) 2026-02-21 14:10:37 +01:00
Piotr Idzik
7c38e5acd2 style: include DM_NEXTINT_VIA_NEXTDOUBLE (#7282) 2026-02-20 20:48:12 +01:00
Ruturaj Jadhav
29ce2ef666 Add RangeSumQuery algorithm in prefix folder (#7280)
* add Subarray Sum Equals K using prefix sum

* Add RangeSumQuery algorithm in prefix folder

* chore: apply clang-format to RangeSumQueryTest file

* Add import statement for JUnit test class

---------

Co-authored-by: Deniz Altunkapan <deniz.altunkapan@outlook.com>
2026-02-19 22:11:56 +01:00
Piotr Idzik
0a2c7f2e3b style: include BL_BURYING_LOGIC (#7277) 2026-02-18 20:32:32 +01:00
Neha-2005-VCE
2ae1bdfd9a feat: add contains() method to DynamicArray (#7270)
* feat: add contains() method to DynamicArray

* style: fix clang formatting

* style: fix clang format issues

* style: apply remaining clang formatting

---------

Co-authored-by: Deniz Altunkapan <deniz.altunkapan@outlook.com>
2026-02-18 18:34:41 +00:00
Syed Mohammad Saad
c9bda3dad7 Add string algorithms: RemoveStars and ComplexNumberMultiply (#7275)
* Add RemoveStars and ComplexNumberMultiply string algorithms

* Add RemoveStars and ComplexNumberMultiply string algorithms

* Add unit tests for RemoveStars and ComplexNumber Multiply

* Fix checkstyle

* Remove redundant main method

* Move ComplexNumberMultiply to maths package and add input validation with tests

* Apply spotless formatting

---------

Co-authored-by: Deniz Altunkapan <deniz.altunkapan@outlook.com>
2026-02-18 18:24:34 +00:00
Piotr Idzik
1646edaeb9 style: remove redundant exclusions (#7276) 2026-02-18 18:06:08 +01:00
Piotr Idzik
dfa6bf0691 style: remove redundant PMD exclusions (#7272) 2026-02-17 22:20:34 +01:00
dependabot[bot]
c8d029107c chore(deps): bump org.junit:junit-bom from 6.0.2 to 6.0.3 (#7271)
Bumps [org.junit:junit-bom](https://github.com/junit-team/junit-framework) from 6.0.2 to 6.0.3.
- [Release notes](https://github.com/junit-team/junit-framework/releases)
- [Commits](https://github.com/junit-team/junit-framework/compare/r6.0.2...r6.0.3)

---
updated-dependencies:
- dependency-name: org.junit:junit-bom
  dependency-version: 6.0.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-02-16 16:57:18 +01:00
Muhammad Muneeb Mubashar
504b5283eb Refactor getAbsValue method to use Math.abs (#7266) 2026-02-13 10:43:27 +01:00
Mohammed Vijahath
0c79d33eb5 Add Tower of Hanoi recursive algorithm (#7235)
* Add Tower of Hanoi recursive algorithm with tests

* Fix SpotBugs issues and format TowerOfHanoi tests

* Enhance existing TowerOfHanoi and remove duplicate recursion version

* Fix clang-format issue

---------

Co-authored-by: Deniz Altunkapan <deniz.altunkapan@outlook.com>
2026-02-11 16:00:15 +01:00
Adarsh-Melath
8403b8feb1 fix:shape's dimension constraints added correctyl (issue id: #7260) (#7261)
* fix:shape's dimension constraints added correctyl  (issue id: #7260)

* fix: base changed to baseLength for better understanding

* fix: base changed to baseLength for better understanding

* base changed to baseLength for better understanding

* fix:cleared some format issues

* fix:cleared some format issues
2026-02-09 18:32:56 +01:00
swativ15
3835c4822a Refactor: simplify validation and improve backtracking cleanup (#7258)
### Summary
This PR makes small readability and maintainability improvements to the algorithm implementation.

### Changes
- Removed a redundant `n < 0` validation check since the method contract already ensures valid `n`
- Replaced `current.remove(current.size() - 1)` with `current.removeLast()` to better express backtracking intent

### Rationale
- Simplifies input validation without changing behavior
- Uses the `Deque` API to make the backtracking step clearer and less error-prone

### Impact
- No change in algorithm logic or time/space complexity
- Output remains identical

Co-authored-by: Swati Vusurumarthi <swativs869@gmail.com>
2026-02-05 22:07:11 +00:00
dependabot[bot]
249b88fea2 chore(deps): bump com.puppycrawl.tools:checkstyle from 13.1.0 to 13.2.0 (#7259)
Bumps [com.puppycrawl.tools:checkstyle](https://github.com/checkstyle/checkstyle) from 13.1.0 to 13.2.0.
- [Release notes](https://github.com/checkstyle/checkstyle/releases)
- [Commits](https://github.com/checkstyle/checkstyle/compare/checkstyle-13.1.0...checkstyle-13.2.0)

---
updated-dependencies:
- dependency-name: com.puppycrawl.tools:checkstyle
  dependency-version: 13.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>
2026-02-05 23:03:26 +01:00
Chahat Sandhu
a14b2345f0 feat: add ElGamalCipher with Safe Prime generation and stateless design (#7257) 2026-02-04 16:49:15 +01:00
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