Skip to content
CAI
Software that uses CAICheck a score

TheAlgorithms/Rust

65.6

Adequate · 14 November 2026

54.2k

lines of production code

Rust

primary language

7

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a comprehensive Rust library providing a wide array of algorithmic implementations and data structures organized into domain-specific modules. It covers core computer science topics such as sorting, searching, graph theory, dynamic programming, and backtracking, alongside specialized domains including cryptography, compression, machine learning, and financial calculations. The library serves as a reference implementation for classic algorithms and utilities, offering tools for everything from big-integer arithmetic to geospatial navigation and signal analysis.

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 algorithm library expansion

16 changes.

This period focused on significantly expanding the library's scope by adding extensive implementations across multiple domains, including string processing, graph theory, geometry, mathematics, and machine learning. New modules were introduced for compression, navigation, conversions, and probabilistic data structures, while existing areas like backtracking and bit manipulation were enriched with diverse algorithms. The work also included infrastructure improvements such as pre-commit hooks to maintain code quality.

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 \src/string\ module now includes a comprehensive suite of new string processing algorithms and utilities. Users can now perform multi-pattern searching with the Aho-Corasick algorithm, efficient text search using Boyer-Moore and Knuth-Morris-Pratt, and palindrome detection via Manacher's algorithm. Additional capabilities include computing string similarity and distance metrics (Hamming, Jaro-Winkler, and Levenshtein distances), checking for anagrams and isograms, generating autocomplete suggestions via a Trie, and applying the Burrows-Wheeler transform for compression. The module also provides utilities for string factorization (Duval's algorithm), isomorphism checking, and run-length encoding.

_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 cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 62 → 66 (+3.8)
  • Rubric changed (rubric-2026.10.5 → rubric-2026.11.4) — scores are not directly comparable.

Lenses

  • Code Health 96 → 93 (-3.1)
  • Architecture 88 → 100 (+12.2)
  • Maturity 49 → 56 (+6.9)
  • Readiness 57 → 57 (-0.0)
  • Security 86 → 86 (+0.0)

Resolved (5)

  • Duplicated block (5 lines × 2) (src/data_structures/avl_tree.rs)
  • Off-boarding risk: anonymized user #1
  • Off-boarding risk: anonymized user #2
  • Off-boarding risk: anonymized user #3
  • Projects may be oversized for their cohesion

New (58)

  • Duplicated block (8 lines × 2) (src/data_structures/avl_tree.rs)
  • Edited copies of one member (3 members, 10+ corresponding lines) (src/general/permutations/heap.rs)
  • Edited copies of one member (3 members, 12+ corresponding lines) (src/graph/detect_cycle.rs)
  • Edited copies of one member (3 members, 12+ corresponding lines) (src/hashing/sha1.rs)
  • Edited copies of one member (3 members, 14+ corresponding lines) (src/math/matrix_ops.rs)
  • Edited copies of one member (3 members, 8+ corresponding lines) (src/machine_learning/loss_function/hinge_loss.rs)
  • Edited copy of a member (10 corresponding lines) (src/data_structures/avl_tree.rs)
  • Edited copy of a member (10 corresponding lines) (src/data_structures/lazy_segment_tree.rs)
  • Edited copy of a member (10 corresponding lines) (src/math/gaussian_elimination.rs)
  • Edited copy of a member (10 corresponding lines) (src/sorting/selection_sort.rs)
  • Edited copy of a member (11 corresponding lines) (src/ciphers/tea.rs)
  • Edited copy of a member (11 corresponding lines) (src/data_structures/probabilistic/bloom_filter.rs)
  • Edited copy of a member (11 corresponding lines) (src/math/exponential_linear_unit.rs)
  • Edited copy of a member (11 corresponding lines) (src/math/simpsons_integration.rs)
  • Edited copy of a member (11 corresponding lines) (src/string/shortest_palindrome.rs)
  • Edited copy of a member (12 corresponding lines) (src/conversions/temperature.rs)
  • Edited copy of a member (12 corresponding lines) (src/data_structures/lazy_segment_tree.rs)
  • Edited copy of a member (12 corresponding lines) (src/data_structures/linked_list.rs)
  • Edited copy of a member (13 corresponding lines) (src/data_structures/fenwick_tree.rs)
  • Edited copy of a member (13 corresponding lines) (src/general/fisher_yates_shuffle.rs)
  • …and 38 more

Written by cca.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 14 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit fed66cb0c74c4a939ec5163648458a8c2b46fd4c — the exact code this score is about.
  • Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
  • Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.65+preprod-36d4cd83012f.