13 unstable releases (5 breaking)

new 0.6.7 Feb 18, 2025
0.6.4 Jan 23, 2025
0.4.0 Feb 23, 2020
0.3.2 Oct 11, 2018
0.2.0 Jul 24, 2018

#196 in Algorithms

Download history 216/week @ 2025-01-14 258/week @ 2025-01-21 23/week @ 2025-01-28 27/week @ 2025-02-04 6/week @ 2025-02-11

327 downloads per month
Used in bund

Custom license

1MB
27K SLoC

Algos

Crates.io Documentation CI GitHub license

🚧 Work in Progress 🚧

This crate is undergoing significant development. It aims to be a comprehensive collection of algorithms implemented in Rust, serving both as a learning resource and a practical library.

Recent Changes

Jan 16, 2025 - ADVISORY: This crate has changed hands and will be maintained by @Brad-Edwards. The repository has been moved to a new location.

Overview

A Rust library implementing a wide range of algorithms, from fundamental computer science concepts to advanced machine learning techniques.

Implementation Status

βœ… Currently Implemented

Sorting Algorithms

βœ… QuickSort
βœ… MergeSort
βœ… HeapSort
βœ… BubbleSort
βœ… InsertionSort
βœ… SelectionSort
βœ… ShellSort
βœ… CountingSort
βœ… RadixSort
βœ… Randomized QuickSelect βœ… Randomized QuickSort βœ… BucketSort

Searching Algorithms

βœ… Linear Search
βœ… Binary Search
βœ… Ternary Search
βœ… Interpolation Search
βœ… Jump Search
βœ… Exponential Search
βœ… Fibonacci Search
βœ… Sublist Search
βœ… Depth-First Search
βœ… Breadth-First Search

String Algorithms

βœ… Knuth-Morris-Pratt (KMP)
βœ… Rabin-Karp
βœ… Boyer-Moore
βœ… Z-Algorithm
βœ… Aho-Corasick
βœ… Suffix Array Construction
βœ… Suffix Automaton
βœ… Suffix Tree
βœ… Rolling Hash
βœ… Manacher's Algorithm

Graph Algorithms (Part 1)

βœ… Dijkstra's Algorithm
βœ… Bellman-Ford Algorithm
βœ… Floyd-Warshall Algorithm
βœ… Prim's Algorithm
βœ… Kruskal's Algorithm
βœ… Tarjan's Algorithm (SCC)
βœ… Kosaraju's Algorithm
βœ… Johnson's Algorithm
βœ… Warshall's Algorithm
βœ… Topological Sort

Graph Algorithms (Part 2)

βœ… Edmond–Karp (max flow)
βœ… Dinic's Algorithm (max flow)
βœ… Ford–Fulkerson (max flow)
βœ… Hungarian Algorithm (assignment)
βœ… Hopcroft–Karp (bipartite matching)
βœ… Bron–Kerbosch (maximal clique)
βœ… Johnson's Cycle Detection
βœ… Floyd's Cycle Detection (Tortoise and Hare)
βœ… Euler Tour / Euler Circuit Algorithm
βœ… Hierholzer's Algorithm (Euler paths/circuits)
βœ… Karger's Min Cut
βœ… Randomized Delaunay Triangulation
βœ… Randomized Kruskal's MST
βœ… Randomized Prim's MST

Dynamic Programming

βœ… Kadane's Algorithm
βœ… Matrix Chain Multiplication
βœ… Edit Distance
βœ… Coin Change
βœ… Longest Common Subsequence
βœ… Longest Increasing Subsequence
βœ… Weighted Interval Scheduling
βœ… Viterbi Algorithm
βœ… Bellman Equation-based DP
βœ… Knuth Optimization

Hashing

βœ… Perfect Hashing
βœ… Universal Hashing
βœ… Cuckoo Hashing
βœ… Separate Chaining
βœ… Open Addressing (linear/quadratic probing, double hashing)
βœ… Polynomial Rolling Hash
βœ… FNV (Fowler–Noll–Vo) Hash
βœ… CRC32
βœ… Jenkins Hash
βœ… MurmurHash

Classic Machine Learning

βœ… k-Means Clustering βœ… k-Nearest Neighbors (k-NN) βœ… Linear Regression (OLS) βœ… Logistic Regression βœ… Decision Tree Learning (ID3, C4.5) βœ… Random Forest βœ… Support Vector Machine (SVM) βœ… Naive Bayes βœ… Gradient Boosting (GBM family) βœ… XGBoost

DO NOT USE Cryptography and Security DO NOT USE

βœ… RSA
βœ… Diffie–Hellman Key Exchange
βœ… ElGamal Encryption
βœ… AES (Rijndael)
βœ… Blowfish
βœ… Twofish
βœ… SHA-256
βœ… MD5 (legacy)
βœ… Elliptic Curve Cryptography (ECC)
βœ… DSA (Digital Signature Algorithm)

Deep Learning & Neural Network Training

βœ… Backpropagation
βœ… Stochastic Gradient Descent (SGD)
βœ… Adam Optimizer
βœ… RMSProp
βœ… AdaGrad
βœ… RProp (resilient propagation)
βœ… Dropout (regularization)
βœ… Batch Normalization
βœ… Convolution (core of CNNs)
βœ… BPTT (Backprop Through Time, RNNs/LSTMs)

Reinforcement Learning

βœ… Q-Learning
βœ… SARSA
βœ… Double Q-Learning
βœ… Deep Q-Network (DQN)
βœ… Monte Carlo Exploring Starts
βœ… Policy Gradients (REINFORCE)
βœ… Actor–Critic Methods
βœ… Proximal Policy Optimization (PPO)
βœ… Trust Region Policy Optimization (TRPO)
βœ… AlphaZero-Style MCTS + RL

Approximation Algorithms

βœ… Greedy Set Cover
βœ… 2-Approximation for Vertex Cover
βœ… PTAS for Knapsack
βœ… Christofides' Algorithm (TSP)
βœ… Johnson's Algorithm for MAX-SAT
βœ… FPTAS for Subset Sum
βœ… Local-Ratio Theorem
βœ… Primal–Dual Approximation (for covering problems)
βœ… LP Rounding (generic approach)
βœ… Goemans–Williamson (Max-Cut)

Linear & Nonlinear Optimization

βœ… Gradient Descent
βœ… Newton's Method
βœ… Conjugate Gradient
βœ… BFGS
βœ… L-BFGS
βœ… Simplex Method (linear programming)
βœ… Interior Point Method (LP/NLP)
βœ… Nelder–Mead
βœ… Genetic Algorithm
βœ… Simulated Annealing

Integer Linear Programming Methods

βœ… Branch and Bound
βœ… Branch and Cut
βœ… Branch and Price
βœ… Gomory Cutting Planes
βœ… Dantzig–Wolfe Decomposition
βœ… Benders Decomposition
βœ… Mixed Integer Rounding Cuts
βœ… Lift-and-Project Cuts
βœ… Branch & Reduce
βœ… Column Generation

Randomized Algorithms

βœ… Randomized BFS 2-SAT
βœ… Reservoir Sampling
βœ… Skip List

Monte Carlo Methods

βœ… Monte Carlo Integration

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

License

This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.

Dependencies

~9MB
~173K SLoC