This repo contains the implementation of various classic algorithms for educational purposes in Rust. It includes a comprehensive list of algorithms. Contributions are welcome!
The main goal right now is to improve docs, code readability and tests.
This repo is only for educational purposes. It is meant to be used as a reference material. Thus, it is written as a library instead of a binary.
The way to check the execution of an algorithm is running the tests, which you can do using:
cargo test
- Bubble
- Bucket
- Cocktail-Shaker
- Counting
- Cycle
- Exchange
- Heap
- Insertion
- Gnome
- Merge
- Odd-even
- Pancake
- Quick
- Radix
- Selection
- Shell
- Stooge
- Comb
- Bucket
- Timsort
- Dijkstra
- Kruskal's Minimum Spanning Tree
- Prim's Minimum Spanning Tree
- Breadth-First Search (BFS)
- Depth First Search (DFS)
- Bellman-Ford
- Prufer Code
- Lowest Common Ancestor
- Heavy Light Decomposition
- Tarjan's Strongly Connected Components
- Topological sorting
- Centroid Decomposition
- Dinic's Max Flow
- 0-1 Knapsack
- Edit Distance
- Longest common subsequence
- Longest continuous increasing subsequence
- Longest increasing subsequence
- K-Means Clustering
- Coin Change
- Rod Cutting
- Egg Dropping Puzzle
- Maximum Subarray
- Is Subsequence
- Maximal Square
- Stack
- Queue
- Heap
- Linked List
- Graph
- Trie
- Binary Search Tree
- B-Tree
- AVL Tree
- RB Tree
- Stack using Linked List
- Segment Tree
- Fenwick Tree
- Union-find
- Naive
- Finite Automaton
- Aho-Corasick Algorithm
- Burrows-Wheeler transform
- Knuth Morris Pratt
- Manacher
- Rabin Carp
- Reverse
- Hamming Distance
- Convex Hull: Graham Scan
- N-Queens Problem
- Graph Coloring
- Tower of Hanoi
- Kmeans
- Two Sum
- Huffman Encoding
- Bit Distance
- Bits Length
- Clear Bit
- Count Ones
- Divide By Two
- Get Bit
- Is Even
- Is Positive
- Is Power Of Two
- Multiply By Two
- Multiply Signed
- Multiply Unsigned
- Set Bit
- Twos Complement
- Update Bit
- Baby-Step Giant-Step Algorithm
- Extended euclidean algorithm
- Gaussian Elimination
- Greatest common divisor
- Greatest common divisor of n numbers
- Least common multiple of n numbers
- Miller Rabin primality test
- Pascal's triangle
- Square root with Newton's method
- Fast power algorithm
- Perfect number
- Prime factors
- Prime number
- Linear Sieve
- Pollard's Rho algorithm
- Quadratic Residue
- Simpson's Rule for Integration
- Fast Fourier Transform
- Armstrong Number
- Permuted Congruential Random Number Generator
- Zeller's Congruence Algorithm
- Karatsuba Multiplication Algorithm
See CONTRIBUTING.md