-
Notifications
You must be signed in to change notification settings - Fork 0
Comparing changes
Open a pull request
base repository: ultramusso/Java-algorithm
base: master
head repository: TheAlgorithms/Java
compare: master
- 18 commits
- 24 files changed
- 15 contributors
Commits on May 2, 2026
-
chore(deps): bump com.puppycrawl.tools:checkstyle from 13.4.1 to 13.4…
….2 (TheAlgorithms#7411) Bumps [com.puppycrawl.tools:checkstyle](https://github.com/checkstyle/checkstyle) from 13.4.1 to 13.4.2. - [Release notes](https://github.com/checkstyle/checkstyle/releases) - [Commits](checkstyle/checkstyle@checkstyle-13.4.1...checkstyle-13.4.2) --- updated-dependencies: - dependency-name: com.puppycrawl.tools:checkstyle dependency-version: 13.4.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 6db8e20 - Browse repository at this point
Copy the full SHA 6db8e20View commit details
Commits on May 3, 2026
-
Update Anagrams.java (TheAlgorithms#7409)
fix: remove invalid reference [1] in Anagrams.java Co-authored-by: Deniz Altunkapan <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 2616e09 - Browse repository at this point
Copy the full SHA 2616e09View commit details
Commits on May 8, 2026
-
Optimized NQueens implementation using hashing (TheAlgorithms#7416)
* Optimized NQueens implementation using hashing * Fixed checkstyle naming issues * Fixed formatting issues * Fixed operator wrap formatting * Fixed formatting issues * Fixed operator wrapping style * Fixed print formatting * Fixed print formatting * Fixed operator formatting * Removed extra brace
Configuration menu - View commit details
-
Copy full SHA for 54341c1 - Browse repository at this point
Copy the full SHA 54341c1View commit details
Commits on May 9, 2026
-
Configuration menu - View commit details
-
Copy full SHA for e814d97 - Browse repository at this point
Copy the full SHA e814d97View commit details
Commits on May 13, 2026
-
feat: add Rat in a Maze backtracking algorithm (TheAlgorithms#7418)
* feat: add Rat in a Maze backtracking algorithm with 10 unit tests * test: add coverage for all-open maze and larger maze path * style: apply clang-format fixes and add newline at end of files * style: apply clang-format and checkstyle fixes
Configuration menu - View commit details
-
Copy full SHA for e7f8979 - Browse repository at this point
Copy the full SHA e7f8979View commit details
Commits on May 15, 2026
-
[ENHANCEMENT] Add Wavelet Tree Data Structure (TheAlgorithms#7414)
* Implement Wavelet Tree with rank and kthSmallest methods * Implement Wavelet Tree with rank and kthSmallest methods * Fix checkstyle multiple variable declarations violation --------- Co-authored-by: Deniz Altunkapan <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 0811cd0 - Browse repository at this point
Copy the full SHA 0811cd0View commit details
Commits on May 16, 2026
-
Configuration menu - View commit details
-
Copy full SHA for 783c96f - Browse repository at this point
Copy the full SHA 783c96fView commit details
Commits on May 17, 2026
-
Docs: add Javadoc to CoinChange class and method (TheAlgorithms#7424)
* Fix: remove floating Javadoc comments causing compilation error * Docs: add Javadoc to CoinChange class and method * Style: apply clang-format to CoinChange.java
Configuration menu - View commit details
-
Copy full SHA for 8848ed1 - Browse repository at this point
Copy the full SHA 8848ed1View commit details
Commits on May 18, 2026
-
fix: add null input validation to AlternativeStringArrange.arrange() (T…
…heAlgorithms#7425) * fix: add null input validation to AlternativeStringArrange.arrange() The arrange() method previously threw a NullPointerException when either input string was null. This change explicitly validates the inputs and throws IllegalArgumentException with a clear message, matching the fail-fast pattern used by other utility classes in this package (e.g. HammingDistance). - Add null guard at the start of arrange() - Update Javadoc with @throws and contract notes - Add parameterized test covering all three null-input combinations * fix: remove unused JUnit @test import (Checkstyle violation)
Configuration menu - View commit details
-
Copy full SHA for 4b8099c - Browse repository at this point
Copy the full SHA 4b8099cView commit details
Commits on May 21, 2026
-
chore(deps): bump org.junit:junit-bom from 6.0.3 to 6.1.0 (TheAlgorit…
…hms#7431) * chore(deps): bump org.junit:junit-bom from 6.0.3 to 6.1.0 Bumps [org.junit:junit-bom](https://github.com/junit-team/junit-framework) from 6.0.3 to 6.1.0. - [Release notes](https://github.com/junit-team/junit-framework/releases) - [Commits](junit-team/junit-framework@r6.0.3...r6.1.0) --- updated-dependencies: - dependency-name: org.junit:junit-bom dependency-version: 6.1.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * style: resolve `DLS_DEAD_LOCAL_STORE` in `testIteratorEmptyBag` --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: vil02 <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 3ee310e - Browse repository at this point
Copy the full SHA 3ee310eView commit details -
feat: add optimized Digit DP template and unit tests (TheAlgorithms#7430
) * feat: add optimized Digit DP template and unit tests * test: add test cases for max target sum and memoization hit to achieve 100% coverage * style: fix indentation and code formatting for clang linter compliance * fix: remove checkstyle inner assignment in solve method * fix: remove checkstyle inner assignment in solve method -newline at end
Configuration menu - View commit details
-
Copy full SHA for 0a62b11 - Browse repository at this point
Copy the full SHA 0a62b11View commit details
Commits on May 25, 2026
-
feat(datastructures): add thread-safe bounded queue implementation (T…
…heAlgorithms#7428) * feat(datastructures): add thread-safe bounded queue implementation Implements a thread-safe blocking queue using ReentrantLock and Condition variables for producer-consumer synchronization. ### What This Adds **ThreadSafeQueue.java** - Thread-safe bounded queue: - `enqueue()` - Blocking add to tail, waits when queue is full - `dequeue()` - Blocking remove from head, waits when queue is empty - `offer()` - Non-blocking add, returns false when full - `poll()` - Non-blocking remove, returns null when empty - `size()`, `isEmpty()`, `isFull()`, `capacity()` - State queries - Uses circular buffer for O(1) enqueue/dequeue operations - Supports multiple concurrent producers and consumers **ThreadSafeQueueTest.java** - Comprehensive test suite: - Basic enqueue/dequeue operations - Offer/poll non-blocking behavior - Null rejection validation - Invalid capacity rejection - Circular buffer wrap-around - Multiple producers single consumer concurrency - Single producer multiple consumers concurrency - Blocking behavior verification - Stress test with 8 concurrent threads ### Algorithm Uses a circular buffer with ReentrantLock and two Condition variables: - `notFull` - signaled when space becomes available - `notEmpty` - signaled when items are added - Producers await notFull when buffer is full - Consumers await notEmpty when buffer is empty - Signal opposite condition after each operation Time: O(1) enqueue/dequeue | Space: O(n) bounded buffer ### Reference https://en.wikipedia.org/wiki/Producer%E2%80%93consumer_problem * fix(datastructures): correct test capacity and simplify concurrent test - testOfferPoll: Changed capacity from 3 to 2 so third offer correctly fails - testMultipleProducersSingleConsumer: Removed startLatch, use dedicated consumer thread with synchronized results list for thread safety * fix(datastructures): remove unused assertArrayEquals import Checkstyle flagged UnusedImports violation for org.junit.jupiter.api.Assertions.assertArrayEquals which was not used in any test method. * fix: replace signal() with signalAll() to satisfy SpotBugs MDM_SIGNAL_NOT_SIGNALALL SpotBugs flags all four Condition.signal() calls in ThreadSafeQueue as Medium severity bugs (MDM_SIGNAL_NOT_SIGNALALL). In a multi-producer/multi-consumer scenario, signal() wakes only one waiting thread, which can cause deadlock when multiple producers or consumers are blocked on the same condition variable. Using signalAll() ensures all waiting threads are notified and can re-check their loop condition, preventing the lost-wakeup problem that occurs when a single signal wakes a thread that cannot make progress. This change affects enqueue(), dequeue(), offer(), and poll() methods where notEmpty.signal() and notFull.signal() are replaced with notEmpty.signalAll() and notFull.signalAll() respectively. * test: replace static imports with Assertions prefix to satisfy PMD TooManyStaticImports PMD flags TooManyStaticImports when more than 4 static imports are present. The test file had 5 static imports from org.junit.jupiter.api.Assertions (equals, assertFalse, assertNull, assertThrows, assertTrue) which exceeded the default threshold. Replaced with regular import and Assertions. prefix to eliminate the PMD violation while maintaining readability.
Configuration menu - View commit details
-
Copy full SHA for e49cd55 - Browse repository at this point
Copy the full SHA e49cd55View commit details
Commits on May 26, 2026
-
docs: improve LinearSearch documentation with examples and step-by-st…
…ep explanation (TheAlgorithms#7435)
Configuration menu - View commit details
-
Copy full SHA for 42007c8 - Browse repository at this point
Copy the full SHA 42007c8View commit details
Commits on May 27, 2026
-
chore(deps-dev): bump org.apache.maven.plugins:maven-surefire-plugin …
…from 3.5.5 to 3.5.6 (TheAlgorithms#7436) 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.5 to 3.5.6. - [Release notes](https://github.com/apache/maven-surefire/releases) - [Commits](apache/maven-surefire@surefire-3.5.5...surefire-3.5.6) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-surefire-plugin dependency-version: 3.5.6 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 0905cbe - Browse repository at this point
Copy the full SHA 0905cbeView commit details
Commits on May 28, 2026
-
Configuration menu - View commit details
-
Copy full SHA for 7b1995f - Browse repository at this point
Copy the full SHA 7b1995fView commit details
Commits on May 31, 2026
-
chore(deps): bump com.puppycrawl.tools:checkstyle from 13.4.2 to 13.5…
….0 (TheAlgorithms#7441) Bumps [com.puppycrawl.tools:checkstyle](https://github.com/checkstyle/checkstyle) from 13.4.2 to 13.5.0. - [Release notes](https://github.com/checkstyle/checkstyle/releases) - [Commits](checkstyle/checkstyle@checkstyle-13.4.2...checkstyle-13.5.0) --- updated-dependencies: - dependency-name: com.puppycrawl.tools:checkstyle dependency-version: 13.5.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 978a306 - Browse repository at this point
Copy the full SHA 978a306View commit details
Commits on Jun 3, 2026
-
test: refactor MergeSortedArrayListTest using JUnit 5 parameterized t…
…ests (TheAlgorithms#7445) * test: upgrade MergeSortedArrayListTest to use JUnit 5 parameterized tests * style: strip trailing whitespace and add trailing newline via IDE * style: align layout with clang-format rules * style: collapse stream arguments to single lines for clang * style: fix line wrapping length for clang linter --------- Co-authored-by: psawale <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 5feaba6 - Browse repository at this point
Copy the full SHA 5feaba6View commit details -
feat(matrix): add QR decomposition algorithm using Gram-Schmidt proce…
…ss (TheAlgorithms#7427) * feat(matrix): add QR decomposition algorithm using Gram-Schmidt process Decomposes a matrix A into an orthogonal matrix Q and an upper triangular matrix R such that A = Q * R. ### What This Adds **QRDecomposition.java** - Main algorithm implementation: - `decompose()` - Performs QR factorization using the Gram-Schmidt process - Returns a QR object containing both Q (orthogonal) and R (upper triangular) matrices - Validates input matrix using MatrixUtil.validateInputMatrix() - Throws ArithmeticException for rank-deficient matrices **QRDecompositionTest.java** - Unit tests: - Tests for 2x2 and 3x3 matrix decomposition - Verifies Q * R reconstruction equals original matrix - Validates Q columns are orthonormal - Confirms R is upper triangular - Tests identity matrix decomposition - Tests rank-deficient matrix rejection - Tests null and empty matrix rejection ### Algorithm The Gram-Schmidt process orthogonalizes columns iteratively: - For each column j, subtract projections onto previous orthogonal vectors - Normalize to get j-th column of Q - Store coefficients in R[i][j] Time: O(m*n^2) | Space: O(m*n + n^2) ### Reference https://en.wikipedia.org/wiki/QR_decomposition * fix(matrix): inline matrix validation to avoid cross-package dependency MatrixUtil is in com.thealgorithms.matrix.utils package which causes compilation errors when referenced from com.thealgorithms.matrix. Inlined the validation logic (validateInputMatrix, hasValidRows, isJaggedMatrix) directly into QRDecomposition to resolve the issue.
Configuration menu - View commit details
-
Copy full SHA for cecfad9 - Browse repository at this point
Copy the full SHA cecfad9View commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff master...master