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
- Bingo
- Bitonic
- Bogo Bogo
- Bogo
- Bubble
- Bucket
- Cocktail-Shaker
- Comb
- Counting
- Cycle
- Exchange
- Gnome
- Heap
- Insertion
- Merge
- Odd-even
- Pancake
- Pigeonhole
- Quick
- Radix
- Selection
- Shell
- Sleep
- Stooge
- Strand
- Timsort
- Tree
- Bellman-Ford
- Breadth-First Search (BFS)
- Centroid Decomposition
- Depth First Search (DFS)
- Dijkstra
- Dinic's Max Flow
- Heavy Light Decomposition
- Kruskal's Minimum Spanning Tree
- Lowest Common Ancestor
- Prim's Minimum Spanning Tree
- Prufer Code
- Tarjan's Strongly Connected Components
- Topological sorting
- 0-1 Knapsack
- Coin Change
- Edit Distance
- Egg Dropping Puzzle
- Is Subsequence
- K-Means Clustering
- Longest common subsequence
- Longest continuous increasing subsequence
- Longest increasing subsequence
- Maximal Square
- Maximum Subarray
- Rod Cutting
- AVL Tree
- B-Tree
- Binary Search Tree
- Fenwick Tree
- Graph
- Heap
- Hashtable
- Linked List
- Queue
- RB Tree
- Segment Tree
- Stack using Linked List
- Stack
- Trie
- Union-find
- Aho-Corasick Algorithm
- Burrows-Wheeler transform
- Finite Automaton
- Hamming Distance
- Knuth Morris Pratt
- Manacher
- Naive
- Rabin Carp
- Reverse
- Convex Hull: Graham Scan
- Graph Coloring
- Huffman Encoding
- Kmeans
- N-Queens Problem
- Tower of Hanoi
- Two Sum
- Bit Distance
- Bit Equivalence
- Clear Bit
- Count Ones
- Divide By Two
- Get Bit
- Is Even
- Is Positive
- Is Power Of Two
- Multiply By Two
- Multiply Signed
- Multiply Unsigned
- Rightmost 1-bit
- Rightmost 0-bit
- Set Bit
- Twos Complement
- Update Bit
- Binary Search Recursive
- Binary Search
- Exponential
- Fibonacci
- Jump
- Kth Smallest
- Linear
- Quick Select
- Ternary Search Min Max Recursive
- Ternary Search Min Max
- Ternary Search Recursive
- Ternary Search
- Armstrong Number
- Baby-Step Giant-Step Algorithm
- Derivative
- Extended euclidean algorithm
- Fast Fourier Transform
- Fast power algorithm
- Gaussian Elimination
- Greatest common divisor of n numbers
- Greatest common divisor
- Karatsuba Multiplication Algorithm
- Least common multiple of n numbers
- Linear Sieve
- Miller Rabin primality test
- Pascal's triangle
- Perfect number
- Permuted Congruential Random Number Generator
- Pollard's Rho algorithm
- Prime factors
- Prime number
- Quadratic Residue
- Simpson's Rule for Integration
- Square root with Newton's method
- Trapezoidal Integration
- Zeller's Congruence Algorithm
See CONTRIBUTING.md