Commit Graph

3153 Commits

Author SHA1 Message Date
DenizAltunkapan
64ecea583a Update DIRECTORY.md 2026-03-11 22:12:48 +00:00
dependabot[bot]
5e06b15926 chore(deps-dev): bump org.mockito:mockito-core from 5.22.0 to 5.23.0 (#7305)
Bumps [org.mockito:mockito-core](https://github.com/mockito/mockito) from 5.22.0 to 5.23.0.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v5.22.0...v5.23.0)

---
updated-dependencies:
- dependency-name: org.mockito:mockito-core
  dependency-version: 5.23.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-03-11 23:12:37 +01:00
lmj798
8e1f12447c test: enhance GenericHashMapUsingArrayTest with comprehensive edge case coverage (#7300)
* test: enhance GenericHashMapUsingArrayTest with additional edge case coverage

* Removed unused assertion 'assertNotEquals' from imports.

* Simplify import statements in GenericHashMapUsingArrayTest

* Refactor assertions to use Assertions class

* Refactor null key test to use variable
2026-03-11 13:31:15 +00:00
Debojeet Bhattacharya
9aa2544f61 Renamed method variables (#7296)
* renamed method variables for improved readibility in the sort method of InsertionSort

* Renamed method in PancackeSort.

* Renamed array "aux" to "tempArray"

---------

Co-authored-by: Deniz Altunkapan <deniz.altunkapan@outlook.com>
2026-03-08 15:27:33 +01:00
Kakkirala Reshma
8b41533d00 Add Javadoc comments for AnyBaseToAnyBase class (#7301)
Added Javadoc comments to describe the algorithm and its complexities.
2026-03-06 15:11:57 +01:00
Alex Tumanov
9875648a83 feat: add TopKFrequentWords with deterministic tie-breaking (#7298) (#7297)
* feat: add TopKFrequentWords with deterministic tie-breaking

* style: format TopKFrequentWords files with clang-format
2026-03-05 14:34:33 +01:00
dependabot[bot]
4b04ad4a83 chore(deps): bump com.puppycrawl.tools:checkstyle from 13.2.0 to 13.3.0 (#7295)
Bumps [com.puppycrawl.tools:checkstyle](https://github.com/checkstyle/checkstyle) from 13.2.0 to 13.3.0.
- [Release notes](https://github.com/checkstyle/checkstyle/releases)
- [Commits](https://github.com/checkstyle/checkstyle/compare/checkstyle-13.2.0...checkstyle-13.3.0)

---
updated-dependencies:
- dependency-name: com.puppycrawl.tools:checkstyle
  dependency-version: 13.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>
Co-authored-by: a <19151554+alxkm@users.noreply.github.com>
2026-03-02 19:56:39 +01:00
kvadrik
d8672882bf Added surface area of a cuboid (#7293)
* Added surface area of a cuboid

Added surface area of a cuboid according to the formula:
S = 2 * (ab + ac + bc)

* Removed extra white space

* Added test for cuboid surface area

* fixed syntax error

* Removed extra space

* Added tests for cuboid surface area that should fail

I have added tests for cuboid surface area where one of the parameters is invalid. These should fail.
2026-02-28 19:13:19 +00:00
kvadrik
0d2a98e9f8 Added volume of a torus (#7294)
* Added volume of a torus

Added function calculation the volume of a torus according to the formula:
V = 2 * pi^2 * R * r^2
where R is the major radius and r is the minor radius of the torus.

* Added test for torus volume
2026-02-28 20:08:50 +01:00
dependabot[bot]
ba286b24d6 chore(deps-dev): bump org.mockito:mockito-core from 5.21.0 to 5.22.0 (#7292)
Bumps [org.mockito:mockito-core](https://github.com/mockito/mockito) from 5.21.0 to 5.22.0.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v5.21.0...v5.22.0)

---
updated-dependencies:
- dependency-name: org.mockito:mockito-core
  dependency-version: 5.22.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-27 22:52:50 +01:00
kvadrik
705eb52833 Added volume of a pyramid frustum (#7291)
* Added volume of a pyramid frustum

Added a function calculating volume of a pyramid frustum, V=(S1+S2+sqrt(S1*S2))*h/3

* compiler error fixed

* Added pyramid frustum test case

* extra space removed
2026-02-27 22:35:42 +01:00
Chahat Sandhu
7e5d9d469d feat: add HuffmanCoding with fail-fast validation and immutable design (#7289) 2026-02-26 12:27:11 +01:00
dependabot[bot]
023f856a9b chore(deps-dev): bump org.apache.maven.plugins:maven-surefire-plugin from 3.5.4 to 3.5.5 (#7288)
chore(deps-dev): bump org.apache.maven.plugins:maven-surefire-plugin

Bumps [org.apache.maven.plugins:maven-surefire-plugin](https://github.com/apache/maven-surefire) from 3.5.4 to 3.5.5.
- [Release notes](https://github.com/apache/maven-surefire/releases)
- [Commits](https://github.com/apache/maven-surefire/compare/surefire-3.5.4...surefire-3.5.5)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-surefire-plugin
  dependency-version: 3.5.5
  dependency-type: direct:development
  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-23 22:55:11 +01:00
Vasundhara117
10114b79ae Add ReverseQueueRecursion.java: Reverse a Queue using recursion (#7281)
* Create ReverseQueueRecursion

Add ReverseQueueRecursion.java:
- Reverses a Queue using recursion (generic <T>)
- Includes unit tests in ReverseQueueRecursionTest.java
- Follows repo style (final class, private constructor, Javadoc)

* Create ReverseQueueRecursionTest.java

Add ReverseQueueRecursionTest as required by CONTRIBUTING.md

* Rename ReverseQueueRecursion to ReverseQueueRecursion.java

* Update ReverseQueueRecursion.java

* Update ReverseQueueRecursion.java

* Update ReverseQueueRecursion.java

* Update ReverseQueueRecursion.java

* Update ReverseQueueRecursionTest.java

* Update ReverseQueueRecursion.java

* Update ReverseQueueRecursionTest.java

* Update ReverseQueueRecursionTest.java

* Update ReverseQueueRecursion.java

* Update ReverseQueueRecursionTest.java

* Update ReverseQueueRecursionTest.java

* Update ReverseQueueRecursionTest.java

* Update ReverseQueueRecursionTest.java

* Update ReverseQueueRecursion.java
2026-02-23 20:06:51 +01:00
Çağlar Eker
12935c291d Add Longest Repeated Substring algorithm (#7286)
* Add Longest Repeated Substring algorithm

Implement LongestRepeatedSubstring in the strings package using the
existing SuffixArray and Kasai's algorithm for LCP array construction.
Includes parameterized unit tests covering typical and edge cases.

* style: reformat test file per clang-format and add coverage test

---------

Co-authored-by: Çağlar Eker <eker.caglar@hepsiburada.com>
2026-02-22 19:15:22 +01:00
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