TheAlgorithms/Java
71.7
Strong · 24 September 2026
76.4k
lines of production code
Java
primary language
4
measurements over time
What this system is
This system is a comprehensive Java library implementing a wide array of computer science algorithms and data structures. It provides concrete implementations for sorting, searching, graph processing, dynamic programming, and various specialized domains including cryptography, geometry, physics, and machine learning. The codebase also includes utility classes for data conversion, string manipulation, and mathematical computations, all supported by a standardized development environment and extensive test coverage.
How it got here
2016–2021 — comprehensive algorithm library expansion
29 changes.
This period focused on significantly expanding the algorithm library by adding implementations across core categories such as data structures, sorting, searching, and dynamic programming. The work also included establishing a standardized development environment with modern Java tooling and enhancing code quality through comprehensive unit test coverage for new and existing algorithms.
2022–2023 — comprehensive test coverage and new algorithm implementations
37 changes.
This period focused on significantly expanding unit test coverage across nearly all existing algorithm packages, including data structures, ciphers, and dynamic programming. It also introduced a wide array of new features, such as CPU scheduling, geometry, greedy, and stack-based algorithms, alongside new data structures like Bloom Filters, CRDTs, and Disjoint Set Union.
2024–2026 — expansion of algorithmic coverage
26 changes.
This period focused on significantly expanding the library's algorithmic breadth by adding implementations across diverse domains, including machine learning, physics simulations, graph theory, and data structures. Each new feature was accompanied by comprehensive unit test suites to ensure correctness and robustness for the newly introduced classes.
Features
Add A5/1 stream cipher implementation
The A5/1 encryption algorithm is now available for use in mobile communications contexts. This change introduces the \A5Cipher\ class as the main entry point, which handles encryption by XORing plaintext with a generated key stream. The implementation relies on a new \A5KeyStreamGenerator\ that manages three Linear Feedback Shift Registers (LFSRs) with specific tapping configurations and clocking logic, supported by base classes \BaseLFSR\ and \CompositeLFSR\ to handle register management and majority-clocking rules. Utility functions for bit manipulation are also included to support the cipher's internal state updates.
src/main/java/com/thealgorithms/ciphers/a5 · high confidence
Add Bloom Filter data structure
Added a new generic BloomFilter implementation in the data structures package, enabling probabilistic membership testing with configurable hash functions and bit array size. The filter supports insertion and containment checks, handling various array types via content-based hashing while ensuring no false negatives.
src/main/java/com/thealgorithms/datastructures/bloomfilter · high confidence
Add EMA and IIR audio filter implementations
The audio filters module now includes two new filter classes: EMAFilter, which applies an exponential moving average to smooth audio signals using a configurable alpha factor, and IIRFilter, which processes audio samples through an N-order Infinite Impulse Response filter with configurable numerator and denominator coefficients. These additions provide users with new signal processing capabilities for smoothing and shaping audio data.
src/main/java/com/thealgorithms/audiofilters · high confidence
Add ProcessDetails entity for CPU scheduling algorithms
A new ProcessDetails entity class has been added to the devutils package to support CPU scheduling implementations. This class models process attributes including process ID, arrival time, burst time, waiting time, turnaround time, and priority, providing the necessary data structure for algorithms such as First-Come-First-Served (FCFS) and Preemptive Priority Scheduling.
src/main/java/com/thealgorithms/devutils/entities · high confidence
Add ZigZag Pattern string encoding algorithm
A new ZigZag Pattern encoding algorithm has been added to the strings package. Users can now convert a string into a zig-zagged format by specifying the number of rows, with the implementation handling edge cases where the string length is smaller than the number of rows or the row count is less than two.
src/main/java/com/thealgorithms/strings/zigZagPattern · high confidence
Add custom BufferedReader implementation for IO operations
A new \BufferedReader\ class has been added to the \com.thealgorithms.io\ package. This implementation mimics the behavior of the standard Java \BufferedReader\ but includes additional capabilities such as \peek(n)\ for lookahead and \readBlock()\ to read chunks of data. It allows users to read from byte arrays or input streams with a configurable buffer size, providing a specialized tool for buffered input processing within the algorithms library.
src/main/java/com/thealgorithms/io · high confidence
Add generic Node class for tree structures
A new generic Node class has been added to the data structures library, allowing nodes to hold values of any type and maintain a list of child nodes. This provides a reusable, type-safe building block for implementing tree-based algorithms like DFS and BFS.
src/main/java/com/thealgorithms/datastructures · high confidence
Add generic node and tree node data structures
The \devutils.nodes\ package now includes a set of generic classes to represent linked list and tree structures: \Node\ as the base class for node data, \SimpleNode\ for singly-linked lists, \TreeNode\ as the base for trees with parent references and depth tracking, \SimpleTreeNode\ for binary trees with left/right children, and \LargeTreeNode\ for trees with a collection of child nodes. These classes provide standard getters, setters, and utility methods like \isLeafNode()\ and \isRootNode()\ to support algorithm implementations.
src/main/java/com/thealgorithms/devutils/nodes · high confidence
Added Bag data structure implementation
A new generic Bag collection has been introduced in the data structures package. This implementation allows users to add elements and iterate over them while preserving insertion order, supports duplicate entries, and provides methods to check for membership and size. It does not support element removal and is not thread-safe.
src/main/java/com/thealgorithms/datastructures/bags · high confidence
Added Cohen-Sutherland and Liang-Barsky line clipping algorithms
Users can now clip line segments against a rectangular window using two new algorithms: Cohen-Sutherland and Liang-Barsky. The Cohen-Sutherland implementation uses region codes to efficiently determine if a line is inside, outside, or partially inside the clipping area, while the Liang-Barsky implementation uses parametric equations to calculate intersection points with window boundaries. Both algorithms are supported by new utility classes for representing Points and Lines.
src/main/java/com/thealgorithms/lineclipping · high confidence
Added Disjoint Set Union data structure implementations
Added new Java implementations of the Disjoint Set Union (Union-Find) data structure to the algorithms library. This includes a base implementation using union by rank, a new implementation using union by size, and a shared Node class to support these structures, providing users with efficient tools for managing disjoint sets.
src/main/java/com/thealgorithms/datastructures/disjointsetunion · high confidence
Added Tower of Hanoi and Word Boggle puzzle solvers
New puzzle-solving algorithms have been added to the library: a recursive solution for the Tower of Hanoi that outputs the sequence of moves, and a Word Boggle solver that uses a Trie data structure to efficiently find valid words on a character board.
src/main/java/com/thealgorithms/puzzlesandgames · high confidence
Expanded CPU scheduling algorithm library
The scheduling package now includes a wide variety of new CPU scheduling algorithms, providing users with diverse options for process management simulations. New additions include Aging, Earliest Deadline First (EDF), First Come First Serve (FCFS), Fair Share, Gang, Highest Response Ratio Next, Job Sequencing with Deadlines, Lottery, Multi-Level Feedback Queue (MLFQ), Multi-Agent, Non-Preemptive Priority, Preemptive Priority, Proportional Fair, Round Robin, Random, Shortest Job First (SJF), Shortest Remaining Time First (SRTF), Self-Adjusting, and Slack Time schedulers. These implementations cover various strategies such as priority-based, time-slice based, deadline-driven, and probabilistic scheduling, allowing for comprehensive testing and educational purposes.
src/main/java/com/thealgorithms/scheduling · high confidence
Expanded dynamic programming algorithm library
The dynamic programming package now includes a wide range of new algorithm implementations, adding capabilities for string manipulation (Abbreviation, Damerau-Levenshtein Distance, Edit Distance, Needleman-Wunsch, Smith-Waterman), combinatorial optimization (0/1 Knapsack via multiple approaches including Brute Force, Memoization, and Tabulation, Partition Problem, Optimal Job Scheduling), and sequence analysis (Climbing Stairs, Coin Change, Fibonacci with Binet's formula, Golomb Sequence, Tribonacci, Longest Increasing/Arithmetic Subsequences, Longest Palindromic Subsequence). Additional additions cover digit-based counting (DigitDP), graph/fill algorithms (Boundary Fill), and various classic DP problems like Board Path, Dice Throw, Egg Dropping, Matrix Chain Multiplication, and Unique Paths.
src/main/java/com/thealgorithms/dynamicprogramming · high confidence
Expanded sorting algorithm library with new implementations and concurrency support
The sorting package now includes a wide range of new algorithm implementations, adding capabilities such as AdaptiveMergeSort, BeadSort, BinaryInsertionSort, BitonicSort, BogoSort, BubbleSort (iterative and recursive), BucketSort, CircleSort, CocktailShakerSort, CombSort, ConcurrentMergeSort, CountingSort, CycleSort, DarkSort, DualPivotQuickSort, DutchNationalFlagSort, ExchangeSort, FlashSort, GnomeSort, HeapSort, and InsertionSort (including sentinel variation). Notably, ConcurrentMergeSort introduces multi-threaded sorting for integer arrays using a ThreadPoolExecutor with automatic fallback to sequential processing for small sub-arrays. These additions provide users with diverse sorting strategies, from standard comparison-based sorts to distribution and parallel approaches, all integrated into the existing SortAlgorithm interface or as standalone utility classes.
src/main/java/com/thealgorithms/sorts · high confidence
Introduction of DynamicArray data structure
A new DynamicArray class has been added to the data structures library, providing a resizable array implementation that automatically expands its capacity when elements are added. This class supports standard operations including adding, retrieving, and removing elements by index, as well as checking for emptiness, size, and containment of specific elements. It also implements the Iterable interface to allow iteration and provides a stream() method for functional-style processing of the contained elements.
src/main/java/com/thealgorithms/datastructures/dynamicarray · high confidence
New CRDT data structures for distributed systems
Added implementations of several Conflict-free Replicated Data Types (CRDTs) to the data structures library, including G-Counter, G-Set, PN-Counter, Two-Phase Set (2P-Set), Last-Write-Wins Element Set (LWWElementSet), and Observed-Remove Set (OR-Set). These additions provide new capabilities for managing shared state in distributed and concurrent environments, supporting operations such as incrementing/decrementing counters, adding/removing elements, and merging states across replicas.
src/main/java/com/thealgorithms/datastructures/crdt · high confidence
New algorithms and utilities added to the 'others' package
This update adds a collection of new algorithm implementations and utility classes to the \com.thealgorithms.others\ package. Users can now use \ArrayLeftRotation\ and \ArrayRightRotation\ for shifting array elements, \BFPRT\ for finding the k-th smallest element in linear worst-case time, and \BoyerMoore\ for identifying majority elements. The package also includes \BankersAlgorithm\ for deadlock detection, \CRC16\, \CRC32\, and \CRCAlgorithm\ for checksum generation and error detection, and \Damm\ for check digit validation. Additional additions are \Conway\ for generating the look-and-say sequence, \FloydTriangle\ for triangle generation, \GaussLegendre\ for high-precision pi calculation, \Huffman\ for data compression, \InsertDeleteInArray\ for array manipulation, \IterativeFloodFill\ for image processing, and \KochSnowflake\ for fractal generation.
src/main/java/com/thealgorithms/misc, src/main/java/com/thealgorithms/others · high confidence
New backtracking algorithms added to the library
The backtracking package now includes a suite of new algorithm implementations: AllPathsFromSourceToTarget (finding all simple paths in a directed graph), ArrayCombination and Combination (generating integer and generic array combinations), CombinationSum (finding subsets summing to a target), CrosswordSolver (placing words in a grid), FloodFill (recursive image coloring), KnightsTour (solving the Knight's Tour problem), MColoring (graph coloring), MazeRecursion (maze solving with two strategies), NQueens (placing N queens on a board), ParenthesesGenerator (valid parenthesis combinations), Permutation (all array permutations), PowerSum (expressing a number as sums of powers), RatInAMaze (finding paths in a binary maze), SubsequenceFinder (all list subsequences), SudokuSolver (solving 9x9 puzzles), UniquePermutation (unique string permutations), and WordPatternMatcher (pattern-to-string matching).
src/main/java/com/thealgorithms/backtracking, src/main/java/com/thealgorithms/compression, src/main/java/com/thealgorithms/randomized · high confidence
New bit manipulation algorithms and utilities added
The bit manipulation package now includes a wide range of new algorithms and utility classes. These additions cover binary conversions (BCD, Gray code, Xs3), bit rotation and swapping, GCD computation (including Stein's algorithm and BigInteger support), and various bit inspection tools (counting set bits, leading zeros, highest/lowest set bits, parity, and Hamming distance). Additional features include checking for binary palindromes, generating subsets via bitmasks, finding non-repeating numbers, and implementing basic Boolean logic gates.
src/main/java/com/thealgorithms/bitmanipulation · high confidence
New cache replacement policies added: FIFO, LIFO, LFU, MRU, and RR
The \src/main/java/com/thealgorithms/datastructures/caches\ package now includes five new cache implementations: \FIFOCache\ (First-In-First-Out), \LIFOCache\ (Last-In-First-Out), \LFUCache\ (Least Frequently Used), \MRUCache\ (Most Recently Used), and \RRCache\ (Random Replacement). These additions expand the available eviction strategies beyond the existing LRU cache, allowing users to select a policy that best fits their specific data access patterns. The new caches support configurable capacities, optional time-to-live (TTL) expiration, and thread-safe operations (where applicable).
src/main/java/com/thealgorithms/datastructures/caches · high confidence
New cipher algorithms and AES mode update
The ciphers package now includes implementations for the ADFGVX, Autokey, Baconian, Affine, and DiffieHellman ciphers, alongside existing algorithms like AES, DES, Blowfish, and ECC. Additionally, the AESEncryption example has been updated to use the more secure AES/GCM/NoPadding mode instead of the default ECB mode.
src/main/java/com/thealgorithms/ciphers · high confidence
New circular buffer and sliding window aggregation data structures
Added a new \CircularBuffer\ class that implements a fixed-size, FIFO ring buffer capable of overwriting oldest data when full, along with a \SlidingWindowAggregator\ that maintains an incremental aggregate (such as sum, min, or max) over a sliding window of elements. The aggregator uses a two-stack algorithm to support any associative operator without requiring invertibility, providing O(1) aggregate retrieval and O(1) amortized insertion and removal costs.
src/main/java/com/thealgorithms/datastructures/buffers · high confidence
New conversion utilities and algorithms added
The conversions package now includes a wide range of new algorithms and utility classes for various data transformations. Users can now convert between coordinate systems (Cartesian and Polar), transform integers to English words or Roman numerals, and handle network address formats (IPv4/IPv6 mapping, IPv4 to binary). Additional support has been added for base conversions (any base to any base, decimal to any base), encoding schemes (Base64), and specific numeric conversions (binary, octal, hexadecimal, endian, affine transformations, and temperature units).
src/main/java/com/thealgorithms/conversions · high confidence
New disk scheduling algorithm implementations added
Added five new disk scheduling algorithm implementations to the library: Shortest Seek First (SFF), SCAN, LOOK, Circular SCAN (C-SCAN), and Circular LOOK (C-LOOK). These classes provide specific logic for ordering disk I/O requests based on different strategies, such as minimizing seek time (SFF), sweeping across the disk (SCAN), or optimizing head movement by stopping at the last request in a direction (LOOK/C-LOOK).
src/main/java/com/thealgorithms/scheduling/diskscheduling · high confidence
New divide-and-conquer algorithms added
The divide-and-conquer package now includes several new algorithm implementations: BinaryExponentiation for efficient power calculation, CountingInversions to count array inversions using a merge-sort approach, MedianOfTwoSortedArrays to find the median of two sorted arrays in logarithmic time, SkylineAlgorithm for computing skyline profiles, StrassenMatrixMultiplication for optimized matrix multiplication, TilingProblem to tile a board with L-shaped tiles, and ClosestPair to find the nearest points in a coordinate system.
src/main/java/com/thealgorithms/divideandconquer · high confidence
New generic and specialized HashMap implementations added
The \src/main/java/com/thealgorithms/datastructures/hashmap/hashing\ package now includes several new data structure implementations: \GenericHashMapUsingArray\ and \GenericHashMapUsingArrayList\ provide generic hash maps using separate chaining with different underlying storage (array vs. ArrayList) and automatic resizing; \HashMap\ offers a basic generic implementation with separate chaining; \HashMapCuckooHashing\ implements open-addressing via Cuckoo Hashing with two hash functions and dynamic resizing; \ImmutableHashMap\ provides a persistent, immutable map using separate chaining; \LinearProbingHashMap\ implements a generic hash table using linear probing with automatic resizing based on load factor; and utility classes \Intersection\ and \MajorityElement\ leverage hash maps for array intersection and majority element detection respectively. A base \Map\ abstract class and \MainCuckooHashing\ demo are also included.
src/main/java/com/thealgorithms/datastructures/hashmap/hashing · high confidence
New geometry algorithms for line drawing, convex hulls, and segment intersection
The geometry package now includes several new algorithms: line drawing via Bresenham's, DDA, and Xiaolin Wu's methods (the latter providing anti-aliased pixel intensities); convex hull computation using Graham Scan, a brute-force approach, and a recursive divide-and-conquer method; segment intersection detection via a utility class and the Bentley-Ottmann sweep-line algorithm; and shape generation using the Midpoint Circle and Midpoint Ellipse algorithms. A new Point record and Haversine distance calculator are also added to support these geometric operations.
src/main/java/com/thealgorithms/geometry · high confidence
New graph algorithms added: max flow, clique enumeration, and more
The graph package now includes several new algorithm implementations: Dinic's and Edmonds-Karp algorithms for maximum flow, Bron-Kerbosch for maximal clique enumeration, Hopcroft-Karp for bipartite matching, Hungarian algorithm for the assignment problem, Edmonds's algorithm for minimum spanning arborescence, Hierholzer's algorithm for Eulerian circuits and paths, a Gomory-Hu tree builder for all-pairs min-cuts, a Constrained Shortest Path solver, a Predecessor-Constrained DFS for DAG traversal, a DSU-based Account Merge utility, and a Traveling Salesman Problem solver.
src/main/java/com/thealgorithms/graph · high confidence
New graph algorithms and data structures added
This update introduces a suite of new graph algorithms and data structures to the library, including A\* pathfinding, Bellman-Ford (with negative cycle detection), bipartite graph checking via DFS, Boruvka's Minimum Spanning Tree, connected component counting, cycle detection, Dials' Algorithm for shortest paths, Dijkstra's shortest path, Edmonds' Blossom Algorithm for maximum matching, Floyd-Warshall all-pairs shortest paths, Ford-Fulkerson maximum flow, and Hamiltonian cycle finding. These additions expand the available graph processing capabilities for users.
src/main/java/com/thealgorithms/datastructures/graphs · high confidence
New greedy algorithm implementations added
The greedy algorithms package now includes several new algorithm implementations: ActivitySelection for selecting maximum non-overlapping activities, BandwidthAllocation for maximizing value from bandwidth distribution, BinaryAddition for adding binary strings, CoinChange for finding minimum coins using a greedy approach, DigitSeparation for splitting large numbers into digits, EgyptianFraction for representing fractions as sums of unit fractions, GaleShapley for stable matching, JobSequencing for maximizing job profits within deadlines, KCenters for minimizing maximum distance to centers, MergeIntervals for combining overlapping intervals, MinimizingLateness for scheduling jobs by deadline, MinimumWaitingTime for optimizing query processing order, OptimalFileMerging for minimizing merge costs using a priority queue, and StockProfitCalculator for finding maximum single-transaction profit.
src/main/java/com/thealgorithms/greedyalgorithms · high confidence
New heap data structures and algorithms added
The \src/main/java/com/thealgorithms/datastructures/heaps\ package now includes several new heap implementations and algorithms: \FibonacciHeap\ for efficient merging and decrease-key operations, \GenericHeap\ for type-safe max-heap operations, \IndexedPriorityQueue\ for addressable priority queues with O(log n) updates, \LeftistHeap\ for efficient merging, and \MinPriorityQueue\ for fixed-capacity min-heaps. Additionally, new algorithm classes \KthElementFinder\, \MedianFinder\, and \MergeKSortedArrays\ leverage heap structures for efficient data processing. Supporting classes \Heap\, \HeapElement\, and \EmptyHeapException\ provide a common interface and element representation for these structures.
src/main/java/com/thealgorithms/datastructures/heaps · high confidence
New interfaces for array and matrix search algorithms
Added \SearchAlgorithm\ and \MatrixSearchAlgorithm\ interfaces in the \devutils.searches\ package to standardize how search algorithms are implemented. The \SearchAlgorithm\ interface defines a contract for searching within a single array, while \MatrixSearchAlgorithm\ provides a similar contract for searching within a 2D matrix, allowing developers to implement consistent search logic across different data structures.
src/main/java/com/thealgorithms/devutils/searches · high confidence
New linked list algorithms and data structures added
The \src/main/java/com/thealgorithms/datastructures/lists\ package now includes several new implementations and algorithms: \CircleLinkedList\ and \CircularDoublyLinkedList\ for circular list structures, \CursorLinkedList\ for an array-based linked list simulation, and \FlattenMultilevelLinkedList\ to merge multilevel lists. Additionally, new utility algorithms have been added for list manipulation and analysis, including \MergeKSortedLinkedList\ (using a min-heap), \MergeSortedSinglyLinkedList\, \ReverseKGroup\, \RotateSinglyLinkedLists\, \MiddleOfLinkedList\ (using the tortoise-and-hare technique), \PalindromeSinglyLinkedList\, \QuickSortLinkedList\, \CountSinglyLinkedListRecursion\, \CreateAndDetectLoop\ (cycle detection), and \RandomNode\ (random selection).
src/main/java/com/thealgorithms/datastructures/lists · high confidence
New machine learning algorithms added: KNN, Linear Regression, and Multinomial Naive Bayes
Three new supervised learning models are now available in the machine learning package. Users can classify data using the K-Nearest Neighbors (KNN) algorithm, which stores training data and predicts labels based on the majority class among the k nearest neighbors using Euclidean distance. A Linear Regression model is also included, implementing batch gradient descent to learn slope and intercept for predicting continuous values. Additionally, a Multinomial Naive Bayes classifier is provided, suited for discrete, count-based features (like text classification) using Laplace smoothing and log-probabilities to avoid numerical underflow.
src/main/java/com/thealgorithms/machinelearning · high confidence
New mathematical algorithms and utility classes added to the maths library
The maths package has been expanded with a wide range of new algorithms and utility classes. New capabilities include fraction arithmetic via ADTFraction, geometric area and volume calculations (Area, Volume), number theory checks (AbundantNumber, AmicableNumber, AutomorphicNumber, BellNumbers, CatalanNumbers, CollatzConjecture, ChineseRemainderTheorem, etc.), signal processing functions (AutoCorrelation, CircularConvolutionFFT, Convolution, ConvolutionFFT, Correlation), and numerical methods (ChebyshevIteration, BinaryPow, Ceil). Existing classes like AbsoluteMax, AbsoluteMin, and Average have been refactored into proper utility classes with improved input validation and documentation.
src/main/java/com/thealgorithms/maths · high confidence
New matrix algorithms and utilities added
The matrix package now includes several new linear algebra and utility classes: InverseOfMatrix for computing matrix inverses via Gaussian elimination, LUDecomposition and QRDecomposition (Gram-Schmidt) for matrix factorizations, SolveSystem for solving linear systems Ax=b, MatrixRank for computing matrix rank, StochasticMatrix for checking row/column stochasticity, MatrixMultiplication for general matrix multiplication, MatrixTranspose for transposing integer matrices, MirrorOfMatrix for mirroring matrices, MedianOfMatrix for finding the median of a matrix, PrintAMatrixInSpiralOrder for spiral traversal, RotateMatrixBy90Degrees for rotating square matrices, Fibonacci for computing Fibonacci numbers via matrix exponentiation, and MatrixUtil as a shared utility for validation and BigDecimal-based matrix operations.
src/main/java/com/thealgorithms/matrix · high confidence
New physics algorithms for electrostatics, gravitation, optics, and motion
The physics package now includes ten new utility classes for scientific calculations. Users can calculate electrostatic forces and orbital velocities with CoulombsLaw, and gravitational forces and orbital velocities with Gravitation. Optics capabilities are added via SnellLaw for refraction angles and ThinLens for image distance, magnification, and image type. Motion simulations are expanded with Kinematics for constant acceleration (SUVAT equations), ProjectileMotion and GroundToGroundProjectileMotion for trajectory analysis, and SimplePendulumRK4 for nonlinear pendulum simulation using the Runge-Kutta 4th order method. Additionally, DampedOscillator models mass-spring-damper systems with analytical and Euler integration methods, ElasticCollision2D handles 2D elastic collisions between circular bodies, and Relativity provides tools for length contraction, time dilation, and velocity addition.
src/main/java/com/thealgorithms/physics · high confidence
New prefix sum algorithm implementations added
The prefix sum package now includes five new algorithm classes: DifferenceArray for efficient range updates, PrefixSum and PrefixSum2D for O(1) range and sub-matrix sum queries, RangeSumQuery as a utility for 1D range sums, and SubarraySumEqualsK to count subarrays summing to a target value k using a HashMap.
src/main/java/com/thealgorithms/prefixsum · high confidence
New prime-related mathematical algorithms added to the Prime package
The \src/main/java/com/thealgorithms/maths/Prime\ package now includes several new classes for number theory operations. Users can calculate the Liouville lambda function (\LiouvilleLambdaFunction\), the Möbius function (\MobiusFunction\), and check for square-free integers (\SquareFreeInteger\). Additionally, primality testing capabilities have been expanded with the Miller-Rabin probabilistic and deterministic tests (\MillerRabinPrimalityCheck\), a standard trial-division prime check (\PrimeCheck\), and a prime factorization utility (\PrimeFactorization\).
src/main/java/com/thealgorithms/maths/Prime · high confidence
New queue data structure implementations and algorithms
The queues package now includes several new implementations and algorithms: a generic CircularQueue using a wrapping array, a Deque (double-ended queue) based on a doubly linked list, a generic LinkedQueue with iterator support, a generic Queue using a circular array, a QueueByTwoStacks implementation, a generic ThreadSafeQueue with blocking capabilities for producer-consumer scenarios, and a TokenBucket rate limiter. Additionally, new utility algorithms have been added: SlidingWindowMaximum for efficiently finding max values in sliding windows using a deque, ReverseQueueRecursion for reversing a queue via recursion, and an enhanced PriorityQueues class using a max-heap. The package also features a GenericArrayListQueue backed by Java's ArrayList.
src/main/java/com/thealgorithms/datastructures/queues · high confidence
New recursive algorithms added to the recursion package
The recursion package now includes several new algorithm implementations: DiceThrower generates all dice roll combinations that sum to a target using recursive backtracking; FactorialRecursion computes factorials recursively with input validation; FibonacciSeries provides a naive recursive Fibonacci calculation with cross-references to other implementations; GenerateSubsets creates the power set of a string via recursion; and SylvesterSequence calculates terms of Sylvester's sequence using BigInteger for precision.
src/main/java/com/thealgorithms/recursion · high confidence
New search algorithms and interface implementations added
This update introduces several new search capabilities to the library. It adds the BM25 Inverted Index for relevance-scored text search, Boyer-Moore and KMP algorithms for efficient string pattern matching, and a 2D array binary search for sorted matrices. Additionally, it provides generic implementations of Binary Search, Iterative Binary Search, Exponential Search, Fibonacci Search, Interpolation Search, Jump Search, Lower Bound, and Ternary Search that adhere to the SearchAlgorithm interface, along with Breadth-First and Depth-First search for graph traversal.
src/main/java/com/thealgorithms/searches · high confidence
New sliding window algorithms added to the library
The sliding window package now includes several new algorithm implementations: counting distinct elements in a window, counting subarrays with exactly k odd numbers, finding the longest subarray with sum less than or equal to K, finding the longest substring without repeating characters, calculating maximum and minimum sums for fixed-size subarrays, finding the minimum window substring containing all characters of another string, and identifying the shortest coprime segment in an array.
src/main/java/com/thealgorithms/slidingwindow · high confidence
New stack data structure implementations and interface
The stacks module now provides a generic \Stack\<T\>\ interface and four distinct implementations: \StackArray\ (array-based with dynamic resizing), \StackArrayList\ (backed by \ArrayList\), \NodeStack\ (linked-node based), and \StackOfLinkedList\ (singly linked list). Additionally, a \ReverseStack\ utility class is introduced to reverse stack contents using recursion, and the module documentation has been updated to explain stack concepts and operations.
src/main/java/com/thealgorithms/datastructures/stacks · high confidence
New stack-based algorithms and data structures added
The \src/main/java/com/thealgorithms/stacks\ package has been expanded with a wide range of new implementations. This includes specialized stacks such as \MinStackUsingSingleStack\ and \MinStackUsingTwoStacks\ for O(1) minimum retrieval, \GreatestElementConstantTime\ for maximum retrieval, and \StackUsingTwoQueues\ for implementing a stack via queues. New algorithms cover expression handling (\InfixToPostfix\, \InfixToPrefix\, \PostfixToInfix\, \PrefixToInfix\, \PostfixEvaluator\, \PrefixEvaluator\), bracket validation (\BalancedBrackets\, \DuplicateBrackets\), and various array problems (\NextGreaterElement\, \NextSmallerElement\, \StockSpanProblem\, \LargestRectangle\, \MaximumMinimumWindow\, \CelebrityFinder\). Additional utilities include \DecimalToAnyUsingStack\ for base conversion, \SortStack\ for recursive sorting, and \PalindromeWithStack\ for string palindrome checking.
src/main/java/com/thealgorithms/stacks · high confidence
New streaming algorithms for change detection, filtering, and outlier handling
Added a suite of new classes in the streaming package to support real-time signal processing and statistical analysis. This includes change detectors like ADWIN (adaptive windowing), CUSUM (cumulative sum), and EWMA (exponentially weighted moving average) for identifying shifts in data streams. It also introduces sensor fusion filters such as the Complementary Filter and Extended Kalman Filter for estimating states from noisy or drifting inputs. Additionally, the package now provides robust statistical tools including the Hampel Filter for outlier replacement, Generalized ESD for batch outlier detection, Welford's Algorithm for online mean/variance calculation, and the P2 Quantile Estimator for constant-memory quantile estimation.
src/main/java/com/thealgorithms/streaming · high confidence
New string algorithms and utilities added to the strings package
This update introduces a comprehensive suite of new string processing capabilities to the \com.thealgorithms.strings\ package. Users can now perform multi-pattern matching with the Aho-Corasick algorithm, find the longest palindromic substring via Manacher's algorithm, and identify the longest common substring or repeated substring using optimized approaches. Additional features include checking for isomorphic strings, verifying isograms, and arranging characters from two strings alternately. The package also adds utilities for counting words and non-whitespace characters, checking if characters are in alphabetical order, and calculating Hamming distance. Several classic search algorithms are also included, such as KMP, Horspool, and Kasai's algorithm for LCP array construction.
src/main/java/com/thealgorithms/strings · high confidence
New tree data structures and algorithms added
The trees package now includes several new data structures and algorithms: AVL trees (AVLSimple and AVLTree), B-Trees, Binary Search Trees (iterative and recursive implementations), a generic recursive BST with pretty printing, a basic Binary Tree with parent pointers, Centroid Decomposition, and utility algorithms for boundary traversal, converting trees to strings, and finding ceiling values in BSTs.
src/main/java/com/thealgorithms/datastructures/trees · high confidence
Standardized development environment and code quality tooling
The repository now provides a fully automated, reproducible development setup via Gitpod, including a Dockerfile that installs the Java 21 SDK and clang-format-16 for consistent C-style formatting. To enforce code standards, Checkstyle and PMD configurations have been added to validate naming, imports, and structure, while a custom PMD rule flags redundant main methods. Additionally, SpotBugs and Infer static analysis tools are configured with exclusion lists to suppress known false positives, and a .clang-format file defines the project's formatting rules.
(repo-wide) · high confidence
Test coverage
Added test coverage for CRDT data structures; Added test coverage for FIFO, LIFO, LFU, LRU, MRU, and RR cache implementations; Added test coverage for HashMap implementations and algorithms; Added test coverage for K-Nearest Neighbors, Linear Regression, and Multinomial Naive Bayes classifiers; Added test coverage for Tower of Hanoi and Word Boggle algorithms; Added test coverage for greedy algorithms; Added test coverage for linked list algorithms and data structures; Added test coverage for miscellaneous algorithms; Added test coverage for multiple compression algorithms; Added test coverage for new streaming algorithms; Added test coverage for prefix sum algorithms; Added test coverage for prime number algorithms; Added test coverage for queue data structures and algorithms; Added test coverage for recursion algorithms; Added test coverage for various algorithms in the 'others' package; Added tests for EMAFilter and IIRFilter; Added unit tests for A5 cipher components; Added unit tests for BufferedReader; Added unit tests for CircularBuffer and SlidingWindowAggregator; Added unit tests for Cohen-Sutherland and Liang-Barsky line clipping algorithms; Added unit tests for Disjoint Set Union implementations; Added unit tests for ZigZagPattern encoding; Added unit tests for ciphers in src/test/java/com/thealgorithms/ciphers; Added unit tests for conversion algorithms; Added unit tests for disk scheduling algorithms; Added unit tests for divide-and-conquer algorithms; Added unit tests for geometry algorithms; Added unit tests for graph algorithms; Added unit tests for heap data structures and algorithms; Added unit tests for mathematics algorithms; Added unit tests for new physics algorithms; Added unit tests for search algorithms; Added unit tests for stack data structure implementations; Added unit tests for stack-based algorithms; Added unit tests for string algorithms; Added unit tests for the Bag data structure; Added unit tests for the ProcessDetails entity; Added unit tests for tree data structures and algorithms; Expanded test coverage for bit manipulation algorithms; Expanded test coverage for dynamic programming algorithms; Expanded test coverage for sorting algorithms.
Dependencies
Initial Maven project configuration with Java 21 and modern tooling
The project is now built using Maven with a \pom.xml\ that sets the Java compiler source and target to version 21. It manages dependencies via the JUnit 6.1.3 BOM and explicitly includes AssertJ 3.27.7, Mockito 5.23.0, Commons Lang3 3.20.0, and Commons Collections4 4.6.0. The build lifecycle integrates JaCoCo 0.8.15 for code coverage, Checkstyle 14.1.0 for style checking, SpotBugs 4.10.4.1 (with fb-contrib 7.7.4 and findsecbugs 1.14.0) for static analysis, and PMD 3.28.0 with security rulesets.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 61 → 72 (+10.9)
- Rubric changed (rubric-2026.08.19 → rubric-2026.09.15) — scores are not directly comparable.
Lenses
- Code Health 87 → 92 (+5.5)
- Architecture 100 → 100 (+0.0)
- Maturity 50 → 65 (+15.3)
- Readiness 66 → 68 (+2.4)
- Security 63 → 79 (+16.1)
Resolved (110)
- Coverage not included — suite not readable by the collector
- Dependency hygiene not measured — dependency manifest found but not parsed for hygiene
- Duplicated block (10 lines × 2) (src/main/java/com/thealgorithms/ciphers/AES.java)
- Duplicated block (10 lines × 2) (src/main/java/com/thealgorithms/ciphers/AES.java)
- Duplicated block (10 lines × 2) (src/main/java/com/thealgorithms/datastructures/caches/FIFOCache.java)
- Duplicated block (10 lines × 2) (src/main/java/com/thealgorithms/datastructures/caches/LRUCache.java)
- Duplicated block (10 lines × 2) (src/main/java/com/thealgorithms/datastructures/lists/CircleLinkedList.java)
- Duplicated block (10 lines × 2) (src/main/java/com/thealgorithms/datastructures/trees/Trie.java)
- Duplicated block (10 lines × 2) (src/main/java/com/thealgorithms/greedyalgorithms/BandwidthAllocation.java)
- Duplicated block (10 lines × 2) (src/main/java/com/thealgorithms/maths/FindKthNumber.java)
- Duplicated block (10 lines × 2) (src/main/java/com/thealgorithms/others/SkylineProblem.java)
- Duplicated block (10 lines × 2) (src/main/java/com/thealgorithms/sorts/TreeSort.java)
- Duplicated block (10 lines × 2) (src/main/java/com/thealgorithms/stacks/InfixToPostfix.java)
- Duplicated block (10 lines × 2) (src/main/java/com/thealgorithms/strings/Anagrams.java)
- Duplicated block (11 lines × 2) (src/main/java/com/thealgorithms/ciphers/SimpleSubCipher.java)
- Duplicated block (11 lines × 2) (src/main/java/com/thealgorithms/datastructures/caches/FIFOCache.java)
- Duplicated block (11 lines × 2) (src/main/java/com/thealgorithms/divideandconquer/ClosestPair.java)
- Duplicated block (11 lines × 2) (src/main/java/com/thealgorithms/divideandconquer/ClosestPair.java)
- Duplicated block (11 lines × 2) (src/main/java/com/thealgorithms/graph/EdmondsKarp.java)
- Duplicated block (11 lines × 3) (src/main/java/com/thealgorithms/sorts/LinkListSort.java)
- …and 90 more
New (219)
- Adwin.detectChange (cognitive 21) (src/main/java/com/thealgorithms/streaming/Adwin.java)
- Dependency hygiene PARTLY measured — Maven/Gradle declarations read, no dependency graph resolved
- Duplicated block (10 lines × 2) (src/main/java/com/thealgorithms/ciphers/AES.java)
- Duplicated block (10 lines × 2) (src/main/java/com/thealgorithms/ciphers/AES.java)
- Duplicated block (10 lines × 2) (src/main/java/com/thealgorithms/ciphers/Blowfish.java)
- Duplicated block (10 lines × 2) (src/main/java/com/thealgorithms/ciphers/PlayfairCipher.java)
- Duplicated block (10 lines × 2) (src/main/java/com/thealgorithms/ciphers/Vigenere.java)
- Duplicated block (10 lines × 2) (src/main/java/com/thealgorithms/datastructures/heaps/IndexedPriorityQueue.java)
- Duplicated block (10 lines × 2) (src/main/java/com/thealgorithms/others/BankersAlgorithm.java)
- Duplicated block (10 lines × 2) (src/main/java/com/thealgorithms/stacks/GreatestElementConstantTime.java)
- Duplicated block (10 lines × 2) (src/main/java/com/thealgorithms/stacks/MaximumMinimumWindow.java)
- Duplicated block (10 lines × 3) (src/main/java/com/thealgorithms/datastructures/caches/FIFOCache.java)
- Duplicated block (11 lines × 2) (src/main/java/com/thealgorithms/conversions/RgbHsvConversion.java)
- Duplicated block (11 lines × 2) (src/main/java/com/thealgorithms/datastructures/caches/FIFOCache.java)
- Duplicated block (11 lines × 2) (src/main/java/com/thealgorithms/datastructures/caches/FIFOCache.java)
- Duplicated block (11 lines × 2) (src/main/java/com/thealgorithms/datastructures/caches/LRUCache.java)
- Duplicated block (11 lines × 2) (src/main/java/com/thealgorithms/graph/Dinic.java)
- Duplicated block (11 lines × 2) (src/main/java/com/thealgorithms/greedyalgorithms/BandwidthAllocation.java)
- Duplicated block (11 lines × 2) (src/main/java/com/thealgorithms/others/Damm.java)
- Duplicated block (11–13 lines × 2) (src/main/java/com/thealgorithms/ciphers/SimpleSubCipher.java)
- …and 199 more
Changes since last survey
- 39 commits — 35 feature/other, 4 fixes
By area
- src/main — 19 commits
- (root) — 10 commits
- .github/workflows — 10 commits
Notable commits
- fix: Fix integer overflow in AbsoluteValue.getAbsValue for Integer.MIN_VALUE (#7604)
- fix: fix: RailFenceCipher silently drops newline characters (#7572)
- fix: fix: integer overflow in MobiusFunction (#7574)
- fix: fix: off-by-one bounds guards in SegmentTree (#7573)
- change: feat: add KalmanFilter, a scalar Kalman filter with sensor fusion (#7592)
- change: Add K-Nearest Neighbors classifier (#7563)
- change: Sigmoid Activation function implementation with simplified batch calc… (#7609)
- change: chore(deps): bump actions/setup-java from 5.6.0 to 5.7.0 in /.github/workflows (#7566)
- change: chore(deps): bump actions/setup-java from 5.7.0 to 6.0.0 in /.github/workflows (#7587)
- change: chore(deps): bump actions/setup-java from 6.0.0 to 6.0.1 in /.github/workflows (#7607)
- change: chore(deps): bump com.puppycrawl.tools:checkstyle from 13.10.0 to 13.11.0 (#7581)
- change: chore(deps): bump com.puppycrawl.tools:checkstyle from 13.11.0 to 14.0.0 (#7582)
- change: chore(deps): bump com.puppycrawl.tools:checkstyle from 13.9.0 to 13.10.0 (#7576)
- change: chore(deps): bump com.puppycrawl.tools:checkstyle from 14.0.0 to 14.1.0 (#7594)
- change: chore(deps): bump github/codeql-action from 4.37.3 to 4.37.4 in /.github/workflows (#7565)
- change: chore(deps): bump github/codeql-action from 4.37.4 to 4.37.5 in /.github/workflows (#7569)
- change: chore(deps): bump github/codeql-action from 4.37.5 to 4.37.6 in /.github/workflows (#7570)
- change: chore(deps): bump github/codeql-action from 4.37.6 to 4.37.7 in /.github/workflows (#7578)
- change: chore(deps): bump github/codeql-action from 4.37.7 to 4.37.8 in /.github/workflows (#7584)
- change: chore(deps): bump github/codeql-action from 4.37.8 to 4.37.9 in /.github/workflows (#7589)
- …and 19 more
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
TheAlgorithms/Java was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 24 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit dd8df803f948198b38bdef756fd8d92d6692d396 — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-5f8d0eb43fd7.