← 输入框|github.com|刷新
Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Jojal/Java
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: TheAlgorithms/Java
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 19 commits
  • 34 files changed
  • 13 contributors

Commits on Nov 12, 2026

  1. Configuration menu
    Copy the full SHA
    02ebe07 View commit details
    Browse the repository at this point in the history
  2. chore(deps): bump github/codeql-action from 4.39.2 to 4.39.3 in /.git…

    …hub/workflows (TheAlgorithms#7750)
    
    chore(deps): bump github/codeql-action in /.github/workflows
    
    Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.39.2 to 4.39.3.
    - [Release notes](https://github.com/github/codeql-action/releases)
    - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
    - [Commits](github/codeql-action@v4.39.2...v4.39.3)
    
    ---
    updated-dependencies:
    - dependency-name: github/codeql-action
      dependency-version: 4.39.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>
    dependabot[bot] authored Nov 12, 2026
    Configuration menu
    Copy the full SHA
    3c4f19d View commit details
    Browse the repository at this point in the history
  3. fix(searches): add null safety and empty matrix handling to RowColumn…

    …WiseSorted2dArrayBinarySearch (TheAlgorithms#7725)
    
    * fix(searches): add null safety and empty matrix handling to RowColumnWiseSorted2dArrayBinarySearch
    
    * refactor(searches): scope validation to rectangular matrices per review
    hardikkaurani authored Nov 12, 2026
    Configuration menu
    Copy the full SHA
    07c7ea3 View commit details
    Browse the repository at this point in the history

Commits on Nov 13, 2026

  1. feat: add MoveZeroes algorithm with tests (TheAlgorithms#7738)

    feat: add move-zeroes algorithm with tests
    roshankumar447 authored Nov 13, 2026
    Configuration menu
    Copy the full SHA
    e9957ea View commit details
    Browse the repository at this point in the history
  2. Add ChaCha20 stream cipher (TheAlgorithms#7754)

    * Add ChaCha20 stream cipher
    
    This implementation is intended for educational purposes and should not be used as a replacement for a vetted cryptographic library in production.
    
    * Test ChaCha20 implementation
    
    * Add test for ChaCha20 handling partial blocks
    
    * Refactor CONSTANTS and littleEndianInt method
    
    * Refactor ChaCha20Test for clarity and readability
    
    Refactored nonce and expected byte array initialization for clarity. Updated test methods to improve readability by reducing line breaks.
    hindAlsh authored Nov 13, 2026
    Configuration menu
    Copy the full SHA
    2f04e81 View commit details
    Browse the repository at this point in the history

Commits on Nov 14, 2026

  1. feat: add RightSideViewOfBinaryTree algorithm with tests (TheAlgorith…

    …ms#7734)
    
    * feat: add RightSideViewOfBinaryTree algorithm with tests
    
    * fix: correct input array for testRightSkewedTree
    roshankumar447 authored Nov 14, 2026
    Configuration menu
    Copy the full SHA
    402d3b0 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    401e253 View commit details
    Browse the repository at this point in the history
  3. Detect overflow in Pow.pow (TheAlgorithms#7752)

    Use Math.multiplyExact for overflow handling in pow
    Prasad-Pitke authored Nov 14, 2026
    Configuration menu
    Copy the full SHA
    a006205 View commit details
    Browse the repository at this point in the history

Commits on Nov 16, 2026

  1. chore(deps): bump org.apache.commons:commons-lang3 from 3.21.0 to 3.2…

    …2.0 (TheAlgorithms#7759)
    
    Bumps org.apache.commons:commons-lang3 from 3.21.0 to 3.22.0.
    
    ---
    updated-dependencies:
    - dependency-name: org.apache.commons:commons-lang3
      dependency-version: 3.22.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>
    dependabot[bot] authored Nov 16, 2026
    Configuration menu
    Copy the full SHA
    33f6e94 View commit details
    Browse the repository at this point in the history

Commits on Nov 17, 2026

  1. feat: add TimestampOrderChecker, out of order and duplicate timestamps (

    TheAlgorithms#7733)
    
    Windowed algorithms assume time moves forward. When it does not, nothing fails loudly: a window holds samples that never coexisted, a rate is computed over a negative interval, a duplicate is counted twice. Retries, buffers flushed after a reconnect, several producers writing into one topic and a clock stepped backwards all cause this, and the cheap defence is to check the order explicitly.
    
    Each timestamp is compared with the previous one and classified as INCREASING, DUPLICATE or BACKWARDS. The checker only reports, it does not reorder or drop anything, so lastTimestamp is always the most recent sample, not the largest. It also keeps the worst backwards step, which is what you need to size a reordering buffer. O(1) time per sample and O(1) state; non-finite timestamps are refused.
    
    Tests: the first timestamp is always accepted, an ordered stream has no violations, duplicates and backwards steps are counted separately, the worst step is the largest one and not the last one, the stream is not reordered, scan returns one verdict per timestamp, and reset restores the initial state.
    
    Signed-off-by: alxkm <19151554+alxkm@users.noreply.github.com>
    Co-authored-by: alxkm <19151554+alxkm@users.noreply.github.com>
    alxkm and alxkm authored Nov 17, 2026
    Configuration menu
    Copy the full SHA
    b42e5df View commit details
    Browse the repository at this point in the history
  2. fix(maths): ensure non-composite inputs are rejected in SmithNumber (T…

    …heAlgorithms#7756)
    
    - Reject numbers <= 3 as Smith numbers must be composite (greater than 3)
    - Fix bug where isSmithNumber(0) incorrectly returned true
    - Prevent integer overflow in trial division loop condition by using (long) i * i
    - Add comprehensive test cases covering non-composite inputs (negative numbers, 0, 1), primes, and valid Smith numbers
    spidervirus authored Nov 17, 2026
    Configuration menu
    Copy the full SHA
    e79b0f1 View commit details
    Browse the repository at this point in the history

Commits on Nov 19, 2026

  1. fix(heaps): prevent premature termination and return sorted array in …

    …MinPriorityQueue.heapSort (TheAlgorithms#7765)
    
    fix(heaps): prevent premature loop termination and return sorted elements in MinPriorityQueue.heapSort
    Bhumit267 authored Nov 19, 2026
    Configuration menu
    Copy the full SHA
    c1a7f8d View commit details
    Browse the repository at this point in the history

Commits on Nov 20, 2026

  1. Preserve the high bit in 32-bit Gray code conversion (TheAlgorithms#7761

    )
    
    Co-authored-by: Naveen Kumar <233027881+naveenkumar982@users.noreply.github.com>
    naveenkumar982 and naveenkumar982 authored Nov 20, 2026
    Configuration menu
    Copy the full SHA
    f4d6708 View commit details
    Browse the repository at this point in the history

Commits on Nov 23, 2026

  1. chore(deps): bump actions/setup-java from 6.2.0 to 6.3.0 in /.github/…

    …workflows (TheAlgorithms#7775)
    
    chore(deps): bump actions/setup-java in /.github/workflows
    
    Bumps [actions/setup-java](https://github.com/actions/setup-java) from 6.2.0 to 6.3.0.
    - [Release notes](https://github.com/actions/setup-java/releases)
    - [Commits](actions/setup-java@v6.2.0...v6.3.0)
    
    ---
    updated-dependencies:
    - dependency-name: actions/setup-java
      dependency-version: 6.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>
    dependabot[bot] authored Nov 23, 2026
    Configuration menu
    Copy the full SHA
    9e216aa View commit details
    Browse the repository at this point in the history

Commits on Nov 24, 2026

  1. fix: prevent digit position overflow in OctalToBinary for large octal…

    … inputs (TheAlgorithms#7776)
    
    * fix: use long digit position in OctalToBinary
    
    digitPosition grew as an int and overflowed for octal inputs with 5 or more digits, so convertOctalToBinary(10000) returned a negative value instead of 1000000000000. Making it a long keeps the position exact for the full range the method can represent.
    
    * test: cover OctalToBinary inputs with 5+ octal digits
    
    Fails on the current implementation because digitPosition overflowed int; passes with the long fix.
    Aditya2375 authored Nov 24, 2026
    Configuration menu
    Copy the full SHA
    54d056d View commit details
    Browse the repository at this point in the history
  2. fix: normalize Playfair key before building the matrix (TheAlgorithms…

    …#7779)
    
    * fix: normalize Playfair key before building the matrix
    
    encrypt() normalizes the plaintext (uppercase, J folded into I, non-letters stripped) but the constructor passed the raw key straight into the matrix builder. A lowercase key like "monarchy" or one containing J or punctuation produced a wrong matrix, so ciphertext was garbage and Z could never round-trip. Normalize the key the same way before building the matrix.
    
    * test: cover Playfair keys that are lowercase, contain J, or have non-letters
    
    Regression tests for the key-normalization fix: a lowercase key must behave like its uppercase form, a key containing J must still cover Z in the matrix, and punctuation or digits in the key must be ignored.
    
    ---------
    
    Co-authored-by: Oleksandr <19151554+alxkm@users.noreply.github.com>
    Aditya2375 and alxkm authored Nov 24, 2026
    Configuration menu
    Copy the full SHA
    9870de2 View commit details
    Browse the repository at this point in the history
  3. fix: reject Hill cipher keys whose determinant is not coprime with 26 (…

    …TheAlgorithms#7780)
    
    * fix: reject Hill cipher keys whose determinant is not coprime with 26
    
    The old validation only rejected a determinant of zero modulo 26. A key matrix is invertible mod 26 only when gcd(det, 26) = 1, so keys with determinant 2, 13, etc. passed validation but made encryption lossy: with key [[1,0],[0,2]] both "AA" and "AN" encrypt to "AA". Check coprimality instead, using floorMod so negative determinants are classified correctly.
    
    * test: cover Hill cipher keys with determinant 2, 13, or negative coprime
    
    Regression tests for the key-validation fix: keys with determinant 2 or 13 must be rejected even though they are not zero mod 26, and a key with determinant -1 (coprime) must still be accepted.
    
    ---------
    
    Co-authored-by: Oleksandr <19151554+alxkm@users.noreply.github.com>
    Aditya2375 and alxkm authored Nov 24, 2026
    Configuration menu
    Copy the full SHA
    c86ec0a View commit details
    Browse the repository at this point in the history
  4. fix(misc): prevent overflow when averaging the two middle values of a…

    … running median (TheAlgorithms#7781)
    
    fix(misc): prevent overflow when averaging the two middle values
    
    MedianOfRunningArrayInteger and MedianOfRunningArrayLong both compute
    (a + b) / 2, which overflows once the two middle values of the stream
    are large. For an Integer stream holding Integer.MAX_VALUE and
    Integer.MAX_VALUE - 2 the median came back as -2 instead of
    2147483646; the Long version fails the same way near Long.MAX_VALUE.
    
    Sum in a long for the Integer case, and in a BigInteger for the Long
    case since there is no wider primitive. Add regression tests for both
    types at each end of their range.
    
    Co-authored-by: Oleksandr <19151554+alxkm@users.noreply.github.com>
    shreyanshj10 and alxkm authored Nov 24, 2026
    Configuration menu
    Copy the full SHA
    15a4a9d View commit details
    Browse the repository at this point in the history

Commits on Nov 27, 2026

  1. chore(deps): bump github/codeql-action from 4.39.3 to 4.39.4 in /.git…

    …hub/workflows (TheAlgorithms#7786)
    
    chore(deps): bump github/codeql-action in /.github/workflows
    
    Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.39.3 to 4.39.4.
    - [Release notes](https://github.com/github/codeql-action/releases)
    - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
    - [Commits](github/codeql-action@v4.39.3...v4.39.4)
    
    ---
    updated-dependencies:
    - dependency-name: github/codeql-action
      dependency-version: 4.39.4
      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>
    dependabot[bot] authored Nov 27, 2026
    Configuration menu
    Copy the full SHA
    3e421bc View commit details
    Browse the repository at this point in the history
Loading