Algorithm Implementations
My implementations of classic algorithms and data structures in Python, C, C++ and Java.
Tests included
Clean code
In 4 major programming languages
Vector
Hash Set
Binary Search Tree
Heap
Disjoint Set (Union-Find)
Trie
Segment Tree
Binary Indexed Tree
Category
Algorithms
search
binary search, bisect
sorting
bubble sort, selection sort, merge sort, heap sort, quick sort, k-way merge sort
selection
quick select, BFPRT select
linked list
find middle, reverse linked list, cycle detection, merge sort
tree traversal
recursive, stack, Morris
minimal spanning tree
Prim's, Kruskal's
shortest path
bfs, Dijkstra's, Bellman–Ford, SPFA, Floyd–Warshall, Johnson's
graph search
bidirectional, depth limited, iterative deepening
topological sort
Kahn's, DFS-based, Viterbi shortest path
recursion
permutations, combinations, subsets
string
naive string matcher, KMP string matcher
math
gcd
majority
Boyer–Moore majority vote
sampling
selection-rejection, reservoir sampling, weighted sampling
shuffle
Fisher–Yates
dutch national flag
three way partition