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: datpp/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.
  • 3 commits
  • 5 files changed
  • 4 contributors

Commits on Oct 9, 2026

  1. test: add white-box unit tests for Luhn.luhnCheck (TheAlgorithms#7641)

    * test: add white-box unit tests for Luhn.luhnCheck
    
    Cover the loop (zero, one and many iterations), both outcomes of the
    `i % 2 == 0` and `temp > 9` decisions, boundary values (8 / 10 after
    doubling), valid and invalid checksums, input immutability and null input.
    
    * test: drop null input case flagged by Infer
    
    Infer reports NULLPTR_DEREFERENCE for passing null to luhnCheck on purpose. The method does not document null handling, so the case is removed.
    datpp authored Oct 9, 2026
    Configuration menu
    Copy the full SHA
    cb6f438 View commit details
    Browse the repository at this point in the history
  2. feat: add TDigest, every quantile of a stream from one sketch (TheAlg…

    …orithms#7642)
    
    P2QuantileEstimator tracks one quantile chosen in advance, in constant memory. A t-digest keeps a small list of centroids, each a mean and a weight, sorted by mean, and answers any quantile and the CDF afterwards from the same sketch. A centroid may absorb points only while it spans at most one unit of the scale function k(q) = d / (2 pi) * asin(2q - 1), and asin is steep at both ends, so centroids in the tails stay at one or a few points while those near the median are allowed to grow. The rank error is of the order of 1 / d around the median and shrinks towards q = 0 and q = 1, which is the trade latency percentiles want: p99.9 comes out nearly exact from a sketch of a few kilobytes.
    
    Insertions are buffered and folded into the centroid list in batches, so add is O(log d) amortised; quantile and cdf are O(d) and interpolate linearly between centroids, each treated as sitting at the centre of the weight it carries. The minimum and maximum are tracked separately and returned exactly for q = 0 and q = 1. Two digests merge the way partial sums do, so sketches built on separate shards combine into one. Non-finite samples, invalid weights, quantiles outside [0, 1] and a compression below 10 are refused; queries fold the pending buffer in first, so the class is documented as not thread-safe.
    
    Tests: on 100 000 uniform samples every tested quantile lands within 0.01 of the requested rank; on 200 000 Gaussian samples the rank error stays under a bound that narrows towards the tails, from 0.01 at the median to 0.0005 at q = 0.001 and q = 0.999; three shards merged answer within 0.01 of the true rank, with total weight, minimum and maximum exact; the centroid count stays at or below the compression after 200 000 samples for compressions of 20, 100 and 500; and weighted, sorted, constant and heavily duplicated input are covered.
    
    Signed-off-by: alxkm <[email protected]>
    Co-authored-by: alxkm <[email protected]>
    alxkm and alxkm authored Oct 9, 2026
    Configuration menu
    Copy the full SHA
    5eb9d66 View commit details
    Browse the repository at this point in the history

Commits on Oct 10, 2026

  1. Add Duval's Lyndon factorization algorithm (TheAlgorithms#7639)

    * Add Duval Lyndon factorization
    
    * Test Lyndon factorization
    
    * Handle null input explicitly in Lyndon factorization
    
    * Align null-input test with explicit validation
    vedant0517 authored Oct 10, 2026
    Configuration menu
    Copy the full SHA
    e43ec38 View commit details
    Browse the repository at this point in the history
Loading