TheAlgorithms/Rust
61.1
Adequate · 27 September 2026
54.2k
lines of production code
Rust
primary language
4
measurements over time
What this system is
This system is a comprehensive Rust library providing a wide array of algorithmic implementations and data structures organized by domain. It covers core computer science topics such as sorting, searching, graph theory, and dynamic programming, alongside specialized modules for mathematics, cryptography, machine learning, and financial calculations. The library serves as a reference implementation for classic algorithms and utilities, ranging from basic bit manipulation to complex geometric and signal analysis tools.
How it got here
2018–2019 — Initial scaffolding and library expansion
9 changes.
The project established its foundational structure and contributor guidelines before reorganizing its codebase into domain-specific modules. This period focused on populating the library with a comprehensive suite of algorithms, including extensive implementations for searching, sorting, dynamic programming, data structures, and cryptography.
2020–2023 — comprehensive algorithmic expansion
16 changes.
This period focused on significantly expanding the library's algorithmic coverage by introducing new modules for geometry, navigation, and compression, while adding extensive implementations for string, graph, and mathematical operations. The work also enriched the machine learning capabilities with optimization and loss function modules, and enhanced core utilities with probabilistic data structures, bit manipulation, and backtracking solvers.
2024–2026 — expansion of algorithmic modules
4 changes.
This period focused on significantly expanding the library's capabilities by introducing new modules and algorithms across several domains. Key additions include greedy algorithms for optimization problems, comprehensive financial calculation tools, audio pitch detection via the YIN algorithm, and a consolidated hashing module supporting multiple cryptographic standards.
Features
Add YIN algorithm for audio pitch detection
The signal analysis module now includes the YIN algorithm, allowing users to detect the fundamental frequency of audio signals. This new capability exposes the \Yin\ struct and \YinResult\ types, providing methods to calculate frequency with or without parabolic interpolation for improved accuracy.
_src/signal\analysis · high confidence
Add number theory algorithms: Euler's totient, k-th factor, and bulk totient computation
The \src/number\_theory\ module now exposes three new algorithms for users: \euler\_totient\ calculates Euler's totient function for a single integer, \kth\_factor\ returns the k-th factor of a given number (or -1 if it does not exist), and \compute\_totient\ generates a vector of totient values for all integers up to n. These functions are registered in the module's public API and include comprehensive test coverage for prime, composite, and edge-case inputs.
_src/number\theory · high confidence
Add pre-commit hook for formatting and testing
A new pre-commit hook has been added to the repository that automatically runs \cargo fmt\ to format Rust code and \cargo test\ to execute tests before each commit, ensuring code quality and correctness are maintained at check-in time.
_git\hooks · high confidence
Add probabilistic data structures: Bloom filter and Count-Min Sketch
Users can now utilize two new probabilistic data structures for memory-efficient set membership testing and frequency counting. The Bloom filter provides a constant-space way to test whether an element is a member of a set, allowing for false positives but no false negatives. The Count-Min Sketch offers an approximate frequency count for items in a data stream, trading exactness for constant space complexity. Both structures are implemented with configurable parameters to balance accuracy and memory usage.
_src/data\structures/probabilistic · high confidence
Added navigation formulas for bearing, distance, and Rhumb line calculations
The navigation module now exposes public functions for calculating initial bearing between two coordinates, distance using the Haversine formula, and Rhumb line (loxodrome) calculations including distance, bearing, and destination point. These additions provide users with standard geospatial computation capabilities for route planning and coordinate analysis.
src/navigation · high confidence
Expanded search algorithm library with new implementations and documentation
The \src/searching\ module has been significantly expanded to include a comprehensive suite of search algorithms. New additions include linear, exponential, Fibonacci, jump, interpolation, and saddleback search, alongside multiple variants of binary and ternary search (iterative, recursive, and min/max optimization). The module also introduces selection algorithms such as \kth\_smallest\ (using both partitioning and heap approaches) and \quick\_select\, as well as the Moore voting algorithm for majority element detection. A new README documents the properties and usage of these algorithms, and the module's public API has been updated to export all new functions.
src/searching · high confidence
Initial geometry module with point, segment, and algorithm implementations
The \src/geometry\ module has been introduced, providing foundational geometric primitives and algorithms. This includes the \Point\ and \Segment\ structs with methods for distance, orientation, and intersection checks. Several algorithms are now available: \closest\_points\ for finding the nearest pair of points, \graham\_scan\ and \jarvis\_march\ for computing convex hulls, \ramer\_douglas\_peucker\ for polygon simplification, and \lattice\_points\ for counting integer points within a polygon area.
src/geometry · high confidence
Initial project scaffolding and contributor setup
The repository is initialized with essential configuration files to support development and collaboration. A Gitpod environment is configured via \.gitpod.yml\ and \.gitpod.Dockerfile\ to provide a ready-to-code workspace, while \.gitconfig\ sets up local git hooks. Documentation is established through \CONTRIBUTING.md\ and \README.md\, and the project structure is outlined in \DIRECTORY.md\. Standard repository metadata, including the MIT \LICENSE\ and \.gitignore\ rules for IDE directories, are also added.
(repo-wide) · high confidence
New backtracking algorithms for combinations, graph problems, and puzzles
The \src/backtracking\ module now exposes a suite of new backtracking-based algorithms. Users can generate all combinations of size k, find all valid graph colorings, and detect Hamiltonian cycles in graphs. The module also adds solvers for classic puzzles and problems: the N-Queens problem, the Knight's Tour, the Rat in a Maze, Sudoku, and subset sum checks. Additionally, it provides utilities for generating well-formed parentheses and distinct permutations of integer collections.
src/backtracking · high confidence
New big-integer math utilities: fast factorial, string multiplication, and Poly1305 MAC
The \src/big\_integer\ module now exposes three new capabilities behind the \big-math\ feature: a \fast\_factorial\ function that computes factorials using a Borwein algorithm for improved performance, a \multiply\ function that performs long multiplication on string representations of non-negative integers, and a \Poly1305\ struct implementing the Poly1305 Message Authentication Code as specified in RFC8439. These additions expand the library's mathematical and cryptographic toolset for big-integer operations.
_src/big\integer · high confidence
New bit manipulation algorithms and utilities
The bit manipulation module has been expanded with a suite of new algorithms and helper functions. Users can now convert integers to Binary Coded Decimal (BCD), count trailing zeros, and perform logical and arithmetic bit shifts with binary string visualization. Additional capabilities include finding the highest or rightmost set bit, checking if a number is a power of two, and finding the previous power of two. The module also introduces algorithms for counting set bits (using Brian Kernighan's algorithm), calculating Hamming distance for both integers and strings, generating n-bit Gray codes, reversing 32-bit integers, and swapping odd/even bits. Utility functions for adding integers without the addition operator, finding unique numbers in a paired set, and identifying missing numbers in consecutive sequences are also available.
_src/bit\manipulation · high confidence
New ciphers and encoding modules added to src/ciphers
The src/ciphers directory now includes implementations for the AES, Affine, Baconian, Base16, Base32, Base64, Base85, Caesar, and ChaCha ciphers, along with a README documenting several of them. These additions expand the library's cryptographic and encoding capabilities, providing users with new tools for encryption, decryption, and data encoding directly within this module.
src/ciphers · high confidence
New compression algorithms and image quality metrics added
The compression module now includes implementations for the Burrows-Wheeler Transform (with reversible encoding), Huffman Encoding, LZ77 sliding-window compression, Move-to-Front transform, and Run-Length Encoding. Additionally, a Peak Signal-to-Noise Ratio (PSNR) function has been added to measure the quality of reconstructed or compressed images relative to the original.
src/compression · high confidence
New conversion algorithms and unit modules added to the conversions library
The \src/conversions\ module has been significantly expanded with new capabilities for number base, physical unit, and coordinate conversions. Users can now convert between binary, decimal, hexadecimal, and octal representations (including large integers up to 128 bits). Comprehensive unit conversion modules have been added for energy (70+ units), length (including metric orders of magnitude from meters to yottameters), pressure, speed, temperature, volume, weight, and time. Additional features include IPv4 address to decimal conversion, RGB/CMYK and RGB/HSV color space conversions, rectangular to polar coordinate transformation, and Roman numeral integer conversion.
src/conversions · high confidence
New data structures and algorithms library added
The \src/data\_structures\ module now provides a comprehensive collection of data structures and algorithms, including AVL trees, B-trees, binary search trees, Fenwick trees, heaps, lazy segment trees, linked lists, hash tables, and graph implementations. It also introduces algorithms for cycle detection in linked lists (Floyd's algorithm), as well as support for directed and undirected graphs with edge weighting.
_src/data\structures · high confidence
New dynamic programming algorithms and implementations added
This update introduces a comprehensive suite of new dynamic programming algorithms to the library, including Catalan numbers, coin change, egg dropping puzzle, fractional knapsack, integer partition, string subsequence checking, 0-1 knapsack, longest common subsequence, longest common substring, longest continuous increasing subsequence, longest increasing subsequence, matrix chain multiplication, maximal square, maximum subarray, and minimum cost path. Additionally, the fibonacci module has been expanded with multiple implementation strategies such as iterative, recursive, tail-recursive, classical, logarithmic, memoized, matrix exponentiation, and binary lifting methods. These additions provide users with a wide range of optimized solutions for classic combinatorial and optimization problems.
_src/dynamic\programming · high confidence
New financial algorithms: depreciation, EMI, interest, and more
The financial module now includes several new calculation capabilities: depreciation methods (straight-line, diminishing balance, units-of-production, sum-of-years' digits, and double-declining balance), Equated Monthly Installment (EMI) for loans, simple/compound/APR interest calculations, an exponential moving average for stock price analysis, basic finance ratios (ROI, debt-to-equity, gross profit margin, earnings per sale), Net Present Value (NPV) and its sensitivity analysis, payback period, present value, and the Treynor ratio for portfolio risk assessment.
src/financial · high confidence
New general algorithms: convex hull, genetic algorithm, Huffman encoding, and more
The \src/general\ module now exposes a suite of new algorithmic implementations. Users can compute the convex hull of 2D points using Graham's scan, shuffle arrays with Fisher-Yates, and solve optimization problems via a generic Genetic Algorithm framework (including Roulette Wheel and Tournament selection strategies). Data compression is supported through Huffman Encoding, while array processing gains Kadane's algorithm for maximum subarray sums, K-Means clustering (for f32 and f64), Minimum Excluded Element (MEX) calculation, and subarray sum counting. Classic problems are also included: Tower of Hanoi move generation, N-Queens backtracking, permutation generation, and the Two Sum lookup.
src/general · high confidence
New graph algorithms and data structures added
The graph module now includes implementations for several new algorithms and data structures: Ant Colony Optimization for the Travelling Salesman Problem, A\* search, Bellman-Ford for shortest paths with negative weights, Bipartite Matching (Kuhn's and Hopcroft-Karp algorithms), Breadth-First Search, Centroid Decomposition for trees, Decremental Connectivity for dynamic forest queries, Depth-First Search, Cycle Detection for both directed and undirected graphs, and a Tic-Tac-Toe demo using minimax with DFS. These additions expand the library's capabilities for pathfinding, graph analysis, and optimization problems.
src/graph · high confidence
New greedy algorithms for job sequencing, coin change, range finding, and stable matching
The \src/greedy\ module now exposes four new algorithms: \schedule\_jobs\ for maximizing profit in job sequencing with deadlines, \find\_minimum\_change\ for determining the minimum number of coins for a given value, \smallest\_range\ for finding the tightest range covering elements from multiple sorted lists, and \stable\_matching\ for computing stable pairings based on preference lists. These additions expand the library's algorithmic coverage in the greedy category.
src/greedy · high confidence
New hashing module with Blake2b, MD5, and Fletcher checksum
A new \src/hashing\ module has been introduced, consolidating hash implementations into dedicated files. This adds support for the Blake2b algorithm, the MD5 algorithm (with a hex output helper), and the Fletcher-16 checksum. The module also exposes a \Hasher\ trait and an \HMAC\ struct for extensible hashing, alongside existing SHA-1, SHA-2, and SHA-3 implementations.
src/hashing · high confidence
New loss functions added to the machine learning module
The \src/machine\_learning/loss\_function\ module now exposes seven new loss functions for machine learning tasks: Mean Squared Error (\mse\_loss\), Mean Absolute Error (\mae\_loss\), Hinge Loss (\hng\_loss\), Huber Loss (\huber\_loss\), KL Divergence (\kld\_loss\), Negative Log Likelihood (\neg\_log\_likelihood\), and Average Margin Ranking Loss (\average\_margin\_ranking\_loss\). These functions are implemented in their respective source files and re-exported via the module's public interface, providing users with a broader set of tools for regression, classification, and ranking problems.
_src/machine\_learning/loss\function · high confidence
New mathematical algorithms and functions added to src/math
This change introduces a large set of new mathematical capabilities to the \src/math\ module, including absolute value, aliquot sum, amicable numbers, polygon area, curve integration, Armstrong numbers, statistical measures (mean, median, mode), discrete logarithms, Bell numbers, binary exponentiation, binomial coefficients, Catalan numbers, ceiling, Chinese Remainder Theorem, Collatz sequences, combinations, cross-entropy loss, decimal-to-fraction conversion, Doomsday algorithm, elliptic curves, Euclidean distance, activation functions (ELU, ReLU, Sigmoid, Tanh, Softmax, GELU, Leaky ReLU, Huber Loss), extended Euclidean algorithm, factorials, factors, Fast Fourier Transform, fast power, perfect numbers, and many more number-theoretic and geometric algorithms.
src/math · high confidence
New optimization algorithms: Adam, Momentum, and Gradient Descent
The \src/machine\_learning/optimization\ module now includes three new optimization algorithms for machine learning tasks. Users can now use the Adam optimizer (with optional AdamW decoupled weight decay support), the Momentum optimizer, and a standard Gradient Descent implementation. These are exposed via the module's public API, allowing users to apply these specific optimization strategies to their models.
_src/machine\learning/optimization · high confidence
New permutation algorithms added to the general library
The \src/general/permutations\ module now exposes three distinct algorithms for generating permutations: a naive recursive approach (\permute\ and \permute\_unique\), Heap's algorithm (\heap\_permute\), and the Steinhaus–Johnson–Trotter algorithm (\steinhaus\_johnson\_trotter\_permute\). This adds new public functions to the library, allowing users to choose between different performance characteristics or output orders (e.g., unique permutations only, or adjacent swaps) depending on their needs.
src/general/permutations · high confidence
New string algorithms and utilities added
The string module now includes implementations for several new algorithms and utilities: Aho-Corasick for multi-pattern searching, Boyer-Moore for efficient single-pattern searching, Duval's algorithm for Lyndon word factorization, Jaro-Winkler distance for string similarity, and Manacher's algorithm for finding the longest palindromic substring. Additionally, new features include autocomplete via a Trie data structure, Burrows-Wheeler transform for compression, and checks for anagrams, isograms, lipograms, and pangrams. Error handling has been improved with custom error types for Anagram, Hamming Distance, Isogram, and Lipogram operations, and existing algorithms like KMP and Levenshtein Distance have been updated to handle Unicode characters correctly.
_src/machine\learning, src/string · high confidence
Sorting module expands with numerous new algorithms and documentation
The \src/sorting\ module has been significantly expanded to include a wide variety of sorting algorithms, making them available for use. New additions include Bogo-sort, Bead sort, Binary insertion sort, Bingo sort, Bitonic sort, Bucket sort, Cocktail shaker sort, Comb sort, Counting sort (including a generic version), Cycle sort, Dutch National Flag sort, Exchange sort, Gnome sort, Heap sort (supporting both ascending and descending orders), Insertion sort, Intro sort, Merge sort (both top-down and bottom-up variants), Odd-even sort, Pancake sort, Patience sort, Pigeonhole sort, Quick sort (standard and 3-way), Radix sort, Selection sort, Shell sort, Sleep sort, Stooge sort, Strand sort, Tim sort, Tournament sort, Tree sort, Wave sort, and Wiggle sort. Additionally, a comprehensive \README.md\ has been added to document these algorithms with their properties and references, and the \mod.rs\ file now exports all these new public functions.
src/sorting · high confidence
Behavioural changes
Library module structure reorganized into domain-specific categories
The library's public API has been restructured from a flat or minimal module layout into a comprehensive set of domain-specific modules. Users can now access algorithms and utilities through clearly named categories such as backtracking, big\_integer, bit\_manipulation, ciphers, compression, conversions, data\_structures, dynamic\_programming, financial, general, geometry, graph, greedy, hashing, machine\_learning, math, navigation, number\_theory, searching, signal\_analysis, sorting, and string. This change replaces the previous internal test-only structure with a public, organized namespace for all available functionality.
src · high confidence
Dependencies
Update dependencies and enable strict Clippy lints
The project updates the \nalgebra\ dependency to version 0.35.0 and \rand\ to 0.10.1, while adding \ndarray\ 0.17.2, \num-bigint\, and \num-traits\ as optional dependencies. It also introduces \quickcheck\ and \quickcheck\_macros\ for testing. To enforce code quality, the manifest now configures a comprehensive set of Clippy lints across cargo, nursery, pedantic, restriction, and style categories, allowing specific warnings to suppress noise while enforcing stricter standards on the rest.
(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
This is the PUBLIC form of this artifact. Findings are listed in full, but the details of SECURITY findings — which rule fired, in which file, on which line, and how to fix it — are deliberately withheld, and any secret-scanner results are excluded entirely. Where detail is absent here it was REMOVED FOR PUBLICATION; it is not missing from the analysis. The complete artifact is available from the repository owner.
Score
- CAI 47 → 61 (+14.4)
- Rubric changed (rubric-2026.08.15 → rubric-2026.09.15) — scores are not directly comparable.
Lenses
- Code Health 100 → 94 (-5.6)
- Architecture 100 (new)
- Maturity 34 → 36 (+2.3)
- Readiness 42 → 76 (+34.6)
- Security 69 → 86 (+17.1)
Resolved (17)
- Dimension evaluation failed
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- Low IaC: DS-0026 (.gitpod.Dockerfile)
- No automated tests
- No exposed public API
- No tests found
- Test reliability not included
- The short description 'All algorithms implemented in Rust - for education' omits any mention of the project's purpose beyond being an educational resource; readers cannot infer it from the presence of algorithm names alone. (README.md)
New (101)
- Concentrated knowledge decay
- Dependency hygiene PARTLY measured — Cargo dependencies read, no committed lock to grade for currency
- Duplicated block (10 lines × 2) (src/data_structures/avl_tree.rs)
- Duplicated block (10 lines × 2) (src/math/fast_fourier_transform.rs)
- Duplicated block (11 lines × 2) (src/data_structures/avl_tree.rs)
- Duplicated block (12 lines × 2) (src/data_structures/avl_tree.rs)
- Duplicated block (12 lines × 2) (src/data_structures/rb_tree.rs)
- Duplicated block (12 lines × 2) (src/hashing/sha2.rs)
- Duplicated block (13–21 lines × 2) (src/data_structures/rb_tree.rs)
- Duplicated block (14 lines × 2) (src/hashing/sha2.rs)
- Duplicated block (14–23 lines × 2) (src/data_structures/rb_tree.rs)
- Duplicated block (15 lines × 3) (src/machine_learning/decision_tree.rs)
- Duplicated block (17–18 lines × 2) (src/data_structures/rb_tree.rs)
- Duplicated block (18 lines × 2) (src/searching/ternary_search_min_max.rs)
- Duplicated block (26 lines × 2) (src/data_structures/skip_list.rs)
- Duplicated block (27 lines × 2) (src/ciphers/vernam.rs)
- Duplicated block (48 lines × 2) (src/conversions/volume.rs)
- Duplicated block (4–6 lines × 4) (src/hashing/md5.rs)
- Duplicated block (5 lines × 2) (src/ciphers/tea.rs)
- Duplicated block (5 lines × 2) (src/data_structures/avl_tree.rs)
- …and 81 more
Changes since last survey
- 1 commits — 1 feature/other, 0 fixes
By area
- src/bit_manipulation — 1 commit
Notable commits
- change: chore: resolve new clippy warnings (#1066)
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/Rust 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 27 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 2345c668b05ecb6fa074138bdbc5a1cbf2afaec8 — 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-7c1cb6328e11.