Whenever I face an interesting problem I document the algorithm that I learned to solve it. The goals of this repository is to have clean, efficient and most importantly correct code.
โ
: If the algorithm is tested
๐บ: If the algorithm is untested
- โ Knapsack 0/1 - O(nC) Bottom-Up implementation (Loops)
- โ ๐ฅSequence Alignment - O(nm)
- โ ๐ฅWeighted Interval Scheduling - O(nlog(n))
- โ Kahns Topological Sort - O(n + m)
- โ Bellman-Ford Shortest Path - O(mn)
- ๐บ Floyd-Warshall Shortest Path - O(n3)
- โ Dijkstra Shortest Path - Naive implementation
- โ Dijkstra Shortest Path - O(mlog(n)) - Heap implementation
- ๐บ Karger's Minimum cut
- ๐บ Prim's Algorithm - O(mn) Naive implementation
- โ Prim's Algorithm - O(mlog(n)) Heap implementation
- ๐บ Kruskal's Algorithm - O(mn) implementation
- โ Kruskal's Algorithm - O(mlog(n))
- โ Breadth First Search - O(n + m) - Queue Implementation
- โ Depth First Search - O(n + m) - Stack Implementation
- โ Depth First Search - O(n + m) - Recursive Implementation
- ๐บ Karatsuba Multiplication - O(n1.585)
- โ Intersection of two sets - O(nlog(n)) + O(mlog(m))
- โ Union of two sets - O(nlog(n)) + O(mlog(m))
- ๐บ Pollard p-1 factorization
- ๐บ Euclidean Algorithm - O(log(n))
- ๐บ Extended Euclidean Algorithm - O(log(n))
- ๐บ Sieve of Eratosthenes - O(nlog(log(n)))
- ๐บ Prime factorization - O(sqrt(n))
- โ Ceasar Cipher
- ๐บ Hill Cipher
- ๐บ Vigenere Cipher*
- ๐บ One time pad
- ๐บ RSA-Algorithm
- ๐บ Bisection Method
- ๐บ (simple) Fixpoint iteration
- โ Maintaining Median - O(nlog(n))
- ๐บ Huffman Algorithm
- โ ๐ฅInterval Scheduling - O(nlog(n))
- โ Binary Search - O(log(n))
- โ Bubble sort - O(n2)
- ๐บ Hope sort - O(1), hopefully
- โ Insertion sort - O(n2)
- โ Selection sort - O(n2)
- โ Merge sort - O(nlog(n))
- โ Randomized Quick sort - Average O(nlogn) (Input independent!)
- โ Quick sort - Average O(nlog(n))
I appreciate feedback on potential improvements and/or if you see an error that I've made! Also if you would like to contribute then do a pull request with algorithm & tests! :)