Skip to content
CAI
Software that uses CAICheck a score

keon/algorithms

70.2

Strong · 16 November 2026

21.8k

lines of production code

Python

primary language

5

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a Python library providing a comprehensive collection of algorithmic implementations and data structure classes. It organizes capabilities into distinct modules covering areas such as graph theory, dynamic programming, backtracking, compression, and various standard data structures like trees and heaps. The package exposes a typed public API designed for educational or utility purposes, allowing users to import and utilize these specific computational patterns.

How it got here

2016 — Python package restructuring and cleanup

10 changes.

The repository was reorganized into a formal Python package with standard governance files, while removing numerous incomplete, legacy, or redundant algorithm implementations. This cleanup was accompanied by the addition of comprehensive unit tests to ensure the correctness of the remaining core data structures and algorithms.

2018 — algorithms package expansion and API standardization

8 changes.

This period focused on significantly expanding the algorithms library by introducing comprehensive modules for graphs, heaps, maps, matrices, sets, stacks, and trees. The work also established a unified public API with shared data types and added static type hints to improve usability and code quality.

2019–2026 — comprehensive algorithm library expansion

12 changes.

This period focused on building a comprehensive, modular algorithm library by introducing numerous new packages for data structures, searching, sorting, and various algorithmic paradigms. The work involved implementing a wide array of specific algorithms, including compression, streaming, greedy, backtracking, and mathematical functions, while establishing a standardized project configuration. The result was a significantly expanded public API covering core computer science concepts and practical utility functions.

Features

Add LZW, Huffman, RLE, and Elias compression algorithms

The algorithms/compression module now exposes four new lossless compression implementations: LZW (Lempel-Ziv-Welch), Huffman coding, Run-Length Encoding (RLE), and Elias Gamma/Delta coding. Users can import \lzw\_encode\/\lzw\_decode\, \HuffmanCoding\, \encode\_rle\/\decode\_rle\, and \elias\_gamma\/\elias\_delta\ from \algorithms.compression\ to compress and decompress data using these specific algorithms.

algorithms/compression · high confidence

Add Misra-Gries and 1-Sparse Recovery streaming algorithms

Users can now access two new streaming algorithms in the \algorithms.streaming\ module: \misras\_gries\ for frequency estimation (finding items appearing at least n/k times) and \one\_sparse\ for recovering a unique element from a dynamic stream of signed values. Both algorithms are exposed via the package's public API.

algorithms/streaming · high confidence

Add matrix algorithms module with decomposition, transformation, and utility functions

The \algorithms/matrix\ package now provides a comprehensive set of matrix operations. This includes numerical decompositions such as Cholesky and Crout, along with matrix inversion and exponentiation. Users can also perform image transformations like rotation and transposition, execute sparse matrix and vector operations, and utilize utility algorithms for tasks like spiral traversal, diagonal sorting, path counting, and Sudoku validation.

algorithms/matrix · high confidence

Add queue-based algorithm implementations

New algorithms have been added to the \algorithms/queue\ module, including \max\_sliding\_window\ for finding maximums in a sliding window using a monotonic deque, \MovingAverage\ for calculating averages from a data stream, \reconstruct\queue\ for reordering people by height and position, and \ZigZagIterator\ for interleaving two lists. These implementations are now exported via the package's \\\init\\_.py\.

algorithms/queue · high confidence

Add set algorithms: keyboard row filter, randomized set, and set cover

The \algorithms/set\ module now exposes three new capabilities: \find\_keyboard\_row\ filters words typable on a single QWERTY row; \RandomizedSet\ provides O(1) average-time insert, remove, and random element retrieval; and \set\_covering\ offers both \optimal\_set\_cover\ (exact, brute-force) and \greedy\_set\_cover\ (approximate) solutions for the set cover problem.

algorithms/set · high confidence

Add tree algorithms module with comprehensive binary tree operations

The \algorithms/tree\ package has been added, providing a collection of binary tree and general tree algorithms. This includes traversal methods (inorder, path sums), structural checks (balanced, symmetric, subtree, BST validation), view computations (left, right, top, bottom views), and construction utilities (from preorder/postorder, array to BST). The module also exposes B-Tree data structures and standard node definitions, making these algorithms directly importable via the \algorithms.tree\ namespace.

algorithms/tree · high confidence

Added Gale-Shapley and Kadane's algorithms to the greedy module

The greedy algorithms module now exposes two new capabilities: the Gale-Shapley stable matching algorithm, which finds a stable pairing between two sets (e.g., men and women) based on ranked preferences, and Kadane's algorithm for finding the maximum contiguous subsequence sum in an array of integers. Both functions are now importable directly from the \algorithms.greedy\ package.

algorithms/greedy · high confidence

Introduce algorithms/string package with 40+ string algorithms

The new algorithms/string package provides a collection of string manipulation and analysis algorithms, including palindrome detection, cipher implementations (Caesar, Atbash), text processing (URL domain extraction, license key formatting), and pattern matching (KMP, Rabin-Karp, Z-algorithm). The package exposes these functions through a centralized \_\init\\_.py for easy importing.

algorithms/string · high confidence

Introduce public API and type hints for the algorithms package

The algorithms package now exposes a clean public API, allowing users to import core types like TreeNode, ListNode, and Graph directly from the top-level namespace, alongside the data\_structures module. Additionally, the package is now marked as typed via py.typed, enabling static type checkers to provide type checking for code using these algorithms.

algorithms · high confidence

Introduce shared data types and stack algorithm implementations

This change introduces a new \algorithms.common\ package providing shared data types (\TreeNode\, \ListNode\, \Graph\) to enable composition across algorithm categories. It also adds a new \algorithms.stack\ module containing implementations for stack-based algorithms, including \is\_sorted\, \is\_valid\ (parentheses), \simplify\_path\, \remove\_min\, \stutter\, \switch\_pairs\, \is\_consecutive\, \longest\_abs\_path\, and an \OrderedStack\ class.

algorithms/stack · high confidence

New algorithms/data\_structures package with core data structure implementations

A new \algorithms/data\_structures\ package has been introduced, consolidating core data structure implementations into a single, importable location. Users can now access a unified set of classes including AVL trees, B-trees, Binary Search Trees, Fenwick trees, KD-trees, Red-Black trees, Segment trees (both iterative and recursive), Hash tables (open addressing and separate chaining), Heaps, Priority Queues, Queues, Stacks, Linked Lists, Tries, and Union-Find structures via the \algorithms.data\_structures\ module.

_algorithms/data\structures · high confidence

New array and bit manipulation algorithm modules

The repository now exposes two new top-level algorithm packages: \algorithms.array\ and \algorithms.bit\_manipulation\. The array module provides implementations for common data structure operations including \delete\_nth\, \flatten\, \garage\ (parking rearrangement), \josephus\, \limit\, \longest\_non\_repeat\ (with three variants), \max\_ones\_index\, \merge\_intervals\, \missing\_ranges\, \move\_zeros\, \n\_sum\, \plus\_one\ (three variants), \remove\_duplicates\, \rotate\ (three variants), \summarize\_ranges\, \three\_sum\, \top\_1\, \trimmean\, and \two\_sum\. The bit manipulation module adds bitwise utilities such as \add\_bitwise\_operator\, \binary\_gap\, fundamental bit operations (\get\_bit\, \set\_bit\, \clear\_bit\, \update\_bit\), byte-integer conversions (\int\_to\_bytes\_big\_endian\, etc.), \count\_flips\_to\_convert\, \count\_ones\ (iterative and recursive), \find\_difference\, \find\_missing\_number\ (two variants), \flip\_bit\_longest\_seq\, \gray\_code\, \has\_alternative\_bit\, \insert\_bit\, \is\_power\_of\_two\, \remove\_bit\, \reverse\_bits\, \single\_number\ (three variants), \subsets\, and \swap\_pair\.

_algorithms/bit\manipulation · high confidence

New backtracking algorithm implementations

The backtracking module now includes a comprehensive set of new algorithm implementations, exposing functions for expression operator insertion, anagram checking, array sum combinations, combination sums, factor combinations, word search via trie backtracking, generalized abbreviations, valid parenthesis generation (two variants), phone number letter combinations, minimax game-tree search with alpha-beta pruning, palindrome partitioning, pattern matching, permutations (including iterative and unique variants), and subsets (including unique variants).

_algorithms/backtracking, algorithms/dynamic\programming · high confidence

New graph algorithms and unified module exports

The algorithms/graph package now exposes a comprehensive suite of new graph algorithms via a single \_\init\\.py entry point. Users can import A\ search, Bellman-Ford (with path reconstruction), Floyd-Warshall all-pairs shortest paths, Edmonds' blossom maximum matching, bipartite checking, graph cloning (BFS/DFS), connected component counting (BFS/DFS/Union-Find), cycle detection, Dijkstra (matrix and heap-optimized), clique finding, path finding, Kahn's topological sort, Markov chains, and multiple maximum flow implementations (Ford-Fulkerson, Edmonds-Karp, Dinic, BFS/DFS variants). The module also re-exports core graph data structures (DirectedGraph, Node, DirectedEdge) for backward compatibility.

algorithms/graph · high confidence

New heap-based algorithm implementations added to the algorithms package

The algorithms/heap module now exposes several new algorithmic capabilities: finding the k closest points to an origin, merging k sorted linked lists, computing the skyline from building coordinates, and finding the maximum in a sliding window. These functions are exported via the heap package's \_\init\\_.py, making them directly importable as part of the library's public API.

algorithms/heap · high confidence

New linked-list and math algorithm implementations

This release adds a comprehensive set of new algorithm implementations to the library. The \algorithms/linked\list\ module now exposes a full suite of linked-list operations, including adding two numbers, deep-copying lists with random pointers, cycle detection, palindrome checks, merging, partitioning, and rotation. The \algorithms/math\ module has been expanded with new mathematical functions such as Chebyshev distance, geometric mean, base conversion, and Diffie-Hellman key exchange, all of which are now exported from the package's \\\init\\_.py\ for easy access.

algorithms/math · high confidence

New map-based algorithm implementations and module structure

The \algorithms/map\ package now provides a curated set of algorithms that utilize hash maps and sets, including \is\_anagram\, \is\_isomorphic\, \word\_pattern\, \valid\_sudoku\, and \max\_common\_sub\_string\ (longest common substring). It also introduces \longest\_palindromic\_subsequence\ for finding the length of the longest palindromic substring, and a \RandomizedSet\ class supporting O(1) insert, remove, and random access. These implementations are exported via the \algorithms.map\ module, which also re-exports core hash table data structures (\HashTable\, \ResizableHashTable\, \SeparateChainingHashTable\) from the new \algorithms.data\_structures\ package.

algorithms/map · high confidence

New searching algorithms module with multiple search implementations

The repository now includes a dedicated \algorithms/searching\ package that exposes a comprehensive collection of search algorithms. Users can import functions for standard linear and binary search, as well as specialized variants including exponential, interpolation, jump, ternary, and sentinel search. The module also provides solutions for specific problems such as finding the first or last occurrence of a value, searching in rotated sorted arrays, determining insertion positions, finding the next greatest letter, and solving the two-sum problem using binary search, hash tables, or two-pointer techniques.

algorithms/searching · high confidence

Removals

Removal of built-in type demonstration scripts

The built-in demonstration scripts for list, set, and tuple types have been removed from the builtins directory. This eliminates the example code that illustrated the differences between mutable lists and immutable tuples, specifically the append\_to\_sequence function and its output demonstrations.

builtins · high confidence

Removal of graph traversal and pathfinding modules

The graph module has removed the \find\_path.py\, \graph.py\, and \traversal.py\ files, eliminating the previously available DFS, BFS, and pathfinding algorithms from the codebase.

graph · high confidence

Removal of incomplete HashTable implementation

The HashTable class, which provided a basic map abstract data type with linear probing, has been removed from the codebase. This change eliminates the incomplete implementation, specifically noting that the get method was not implemented, thereby removing a non-functional component from the product.

hashtable · high confidence

Removal of legacy Stack implementation files

The \stack/\_\init\\_.py\ and \stack/stack.py\ files have been deleted, removing the previous \AbstractStack\, \ArrayStack\, and \LinkedListStack\ implementations from the codebase.

stack · high confidence

Removal of legacy tree algorithm implementations

The repository has removed several standalone Python scripts for binary tree operations, including deepest\_left, invert\_tree, max\_height, same\_tree, tree, and trie. These files, which contained specific algorithm implementations and node classes, are no longer part of the codebase.

tree · high confidence

Removal of linked list and binary search algorithm implementations

The \linkedlist\ module containing \DoublyLinkedList\ and \SinglyLinkedList\ classes has been removed, along with several files in the \search\ module (\binarySearch.py\, \countElem.py\, \firstOccurance.py\, and \lastOccurance.py\) that provided binary search variants for finding elements and counting occurrences. These algorithmic utilities are no longer available for use.

linkedlist, search · high confidence

Removal of string utility module

The \string/reverseWords.py\ module has been removed from the codebase. This eliminates the \reverse\ and \reverseWords\ functions that previously manipulated arrays in place, meaning any code relying on these specific string manipulation utilities will no longer have access to them.

string · high confidence

Removed queue module implementation

The queue module, including the \_\init\\_.py entry point and the queue.py file containing AbstractQueue, ArrayQueue, LinkedListQueue, and HeapPriorityQueue classes, has been deleted from the codebase.

queue · high confidence

Behavioural changes

Repository restructured into a Python package with new project governance files

The repository has been reorganized into a formal Python package named 'algorithms', introducing a structured directory layout (e.g., algorithms/graph, algorithms/sorting) and a MANIFEST.in file for packaging. To support this transition, several legacy standalone scripts (longestAbsPath.py, reverseString.py, sorting.py, testStack.py) and a tutorial text file (matrix\_rotation.txt) have been removed. The project now includes standard governance and configuration files: a .gitignore for Python artifacts, a LICENSE (MIT), a CODE\_OF\_CONDUCT.md, and an updated CONTRIBUTING.md. The README.md has been rewritten to provide installation instructions via pip, usage examples for the new package structure, and a comprehensive list of available data structures and algorithms.

(repo-wide) · high confidence

Sorting algorithms module restructured and expanded

The sorting algorithms package has been reorganized under the new \algorithms.sorting\ namespace, replacing the previous \algorithms.sort\ location. This update introduces a comprehensive suite of sorting implementations, including bead, bitonic, bogo, bubble, bucket, cocktail shaker, comb, counting, cycle, exchange, gnome, heap (max/min), insertion, merge, pancake, pigeonhole, quick, radix, selection, shell, stooge, and wiggle sorts. Additionally, utility functions for sorting-based problems such as \sort\_colors\ (Dutch National Flag) and \can\_attend\_meetings\ are now available within this module.

algorithms/sorting · high confidence

Test coverage

Comprehensive test coverage for algorithms and data structures

Added a full suite of unit tests across the repository, covering array operations (e.g., Josephus, flatten, longest non-repeat), backtracking (e.g., permutations, combination sum), bit manipulation, compression algorithms (Huffman, RLE, LZW, Elias), data structures (AVL, Red-Black, Trie, Union-Find, Segment Tree), dynamic programming (knapsack, edit distance, house robber), graph algorithms (Dijkstra, Tarjan, maximum flow), greedy approaches, heaps, and specific issue fixes (Goldbach's conjecture, binary tree views, square root decomposition). These tests ensure correctness and prevent regressions for the core algorithmic implementations.

tests · high confidence

Dependencies

Initial project configuration and dependency manifest

The project now includes a pyproject.toml file that defines the package metadata (name 'algorithms', version 1.0.1) and build requirements (setuptools \>= 68.0). It specifies Python 3.10+ as the minimum version and lists development dependencies including pytest, ruff, mypy, and black. Configuration sections are added for pytest, ruff (with specific lint rules), mypy, and black to standardize code quality and formatting.

(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 67 → 70 (+3.7)
  • Rubric changed (rubric-2026.11.2 → rubric-2026.11.4) — scores are not directly comparable.

Lenses

  • Code Health 96 → 92 (-4.2)
  • Architecture 89 → 100 (+10.8)
  • Maturity 64 → 68 (+3.8)
  • Readiness 55 → 60 (+4.9)
  • Security 86 → 86 (+0.0)

Resolved (4)

  • Dependency hygiene PARTLY measured — Python dependencies read, no exact pin to grade for currency
  • Duplicated block (13 lines × 2) (algorithms/dynamic_programming/longest_increasing.py)
  • Off-boarding risk: anonymized user #1
  • Projects may be oversized for their cohesion

New (43)

  • Dependency hygiene PARTLY measured — Python dependencies read, dependency currency not (the index lookup answered not published)
  • Edited copies of one member (3 members, 25+ corresponding lines) (algorithms/tree/path_sum.py)
  • Edited copies of one member (4 members, 21+ corresponding lines) (algorithms/matrix/copy_transform.py)
  • Edited copy of a member (11 corresponding lines) (algorithms/graph/count_connected_number_of_component.py)
  • Edited copy of a member (13 corresponding lines) (algorithms/data_structures/avl_tree.py)
  • Edited copy of a member (13 corresponding lines) (algorithms/data_structures/red_black_tree.py)
  • Edited copy of a member (14 corresponding lines) (algorithms/tree/is_subtree.py)
  • Edited copy of a member (14 corresponding lines) (algorithms/tree/traversal_postorder.py)
  • Edited copy of a member (16 corresponding lines) (algorithms/graph/count_islands_dfs.py)
  • Edited copy of a member (16 corresponding lines) (algorithms/sorting/heap_sort.py)
  • Edited copy of a member (16 corresponding lines) (algorithms/tree/traversal_level_order.py)
  • Edited copy of a member (18 corresponding lines) (algorithms/data_structures/hash_table.py)
  • Edited copy of a member (18 corresponding lines) (algorithms/data_structures/red_black_tree.py)
  • Edited copy of a member (18 corresponding lines) (algorithms/dynamic_programming/longest_increasing.py)
  • Edited copy of a member (19 corresponding lines) (algorithms/math/diffie_hellman_key_exchange.py)
  • Edited copy of a member (21 corresponding lines) (algorithms/backtracking/palindrome_partitioning.py)
  • Edited copy of a member (22 corresponding lines) (algorithms/backtracking/factor_combinations.py)
  • Edited copy of a member (23 corresponding lines) (algorithms/array/longest_non_repeat.py)
  • Edited copy of a member (23 corresponding lines) (algorithms/array/longest_non_repeat.py)
  • Edited copy of a member (23 corresponding lines) (algorithms/graph/traversal.py)
  • …and 23 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

keon/algorithms 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 16 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 bd1d152f9ec7331c69be662831610b003b10fc7a — 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.73+preprod-52de90b74216.