This category covers Rust implementations of core algorithms , such as sorting and random value generation.
The following table denotes the most common crates used for each algorithm category.
Topic Rust Crates Notes
Sorting std::cmp
↗ , itertools
↗ , rand
↗std::cmp
provides ordering traits, itertools
↗ iterators, rand
↗ for generating test data. No single crate is the sorting crate, as std::slice::sort
is often sufficient.
Searching std::cmp
↗Binary search is available in the standard library.
Data Structures (General) std::collections
↗ for common structures (Vec
↗, HashMap
↗, etc.), im
↗ , petgraph
↗std::collections
for common structures (Vec, HashMap, etc.), im
↗ for immutable data structures, petgraph
↗ for graphs.
Graph Algorithms petgraph
↗ , pathfinding
↗petgraph
↗ is a popular graph library. pathfinding
↗ provides pathfinding algorithms.
Dynamic Programming Often implemented without external crates DP is often implemented using standard library features like vectors and iterators.
String Algorithms regex
↗ , aho-corasick
↗ , strsim
↗regex
↗ for regular expressions, aho-corasick
↗ for multiple pattern searching, strsim
↗ for string similarity.
Numerical Algorithms nalgebra
↗ , ndarray
↗ , num
↗nalgebra
↗ for linear algebra, ndarray
↗ for N-dimensional arrays, num
↗ for numeric traits.
Cryptography ring
↗ , rust-crypto
↗ , sha2
↗Several crates exist; choose carefully based on security needs and audit history.
Topic Related Links
Data Structures Concurrent Data Structures
Mathematics Additional Numeric Types, Complex Numbers, Linear Algebra, Statistics, Trigonometry.