Algorithm
Import algorithm data structures, direct functions, and study results from tyrus:algorithm. The module provides native, high-performance implementations of classic data structures together with deterministic algorithm metrics. All handle types are generic except FenwickTree, SegmentTree, SparseTable, SegmentTreeLazy, BitSet, BloomFilter, and Trie. Native handles are released automatically when their binding goes out of scope.
| Algorithm | Description | Page |
|---|---|---|
UnionFind<T> | Disjoint set (union-find) with path compression and union by rank | UnionFind |
BinaryHeap<T> | Binary max-heap priority queue | BinaryHeap |
BinomialHeap<T> | Binomial max-heap priority queue with O(log n) meld | BinomialHeap |
Counter<T> | Frequency counter with insertion-order preservation | Counter |
Deque<T> | Double-ended queue | Deque |
FenwickTree | Fenwick tree (binary indexed tree) for prefix sums | FenwickTree |
SegmentTree | Segment tree for range queries and point updates | SegmentTree |
SparseTable | Immutable RMQ table for range minimum queries | SparseTable |
SegmentTreeLazy | Segment tree for range queries and range additions | SegmentTreeLazy |
BitSet | Compact bit set with set-theoretic operations | BitSet |
BloomFilter | Probabilistic set membership with a configurable false-positive rate | BloomFilter |
Graph<N, W> | Directed weighted graph with automatic node creation and DOT rendering | Graph |
bfs / bfsInfo | Breadth-first traversal or its study result | BFS |
dfs / dfsInfo | Iterative depth-first traversal or its study result | DFS |
iddfs / iddfsInfo | Iterative-deepening traversal or its study result | IDDFS |
dijkstra / dijkstraInfo | Non-negative shortest path or its study result | Dijkstra |
aStar / aStarInfo | Heuristic shortest path or its study result | A* |
bellmanFord / bellmanFordInfo | Negative-weight shortest paths or their study result | Bellman-Ford |
floydWarshall / floydWarshallInfo | Dense all-pairs shortest paths or their study result | Floyd-Warshall |
spfa / spfaInfo | Queue-based shortest paths or their study result | SPFA |
johnson / johnsonInfo | Sparse all-pairs shortest paths or their study result | Johnson |
kruskal | Minimum spanning forest with disjoint sets | kruskal |
prim | Minimum spanning tree with a priority queue | prim |
boruvka | Minimum spanning forest for dense graphs | boruvka |
steinerTree | Weighted terminal connection tree | steinerTree |
edmondsKarp | Maximum flow with breadth-first augmenting paths | edmondsKarp |
dinic | Maximum flow with level graphs | dinic |
pushRelabel | Maximum flow with vertex heights | pushRelabel |
minCut | Minimum cut from maximum flow | minCut |
minCostMaxFlow | Minimum-cost maximum flow | minCostMaxFlow |
topologicalSortKahn | Topological ordering with indegrees | topologicalSortKahn |
topologicalSortDfs | Topological ordering with DFS | topologicalSortDfs |
tarjanScc | Strongly connected components with Tarjan | tarjanScc |
kosarajuScc | Strongly connected components with Kosaraju | kosarajuScc |
fleuryEulerian | Eulerian path with Fleury | fleuryEulerian |
hierholzerEulerian | Eulerian path with Hierholzer | hierholzerEulerian |
findBridges | Bridge detection | findBridges |
findCutVertices | Articulation point detection | findCutVertices |
biconnectedComponents | Biconnected component decomposition | biconnectedComponents |
edmondsBlossom | Maximum general-graph matching | edmondsBlossom |
hungarian | Minimum-cost assignment | hungarian |
mergeSort / mergeSortInfo | Stable merge sort and its study result | mergeSort |
quickSort / quickSortInfo | Average-case quick sort or its study result | quickSort |
heapSort / heapSortInfo | Heap sort or its study result | heapSort |
countingSort / countingSortInfo | Counting sort or its study result | countingSort |
radixSort / radixSortInfo | Radix sort or its study result | radixSort |
bucketSort / bucketSortInfo | Bucket sort or its study result | bucketSort |
timSort / timSortInfo | Hybrid comparison sort or its study result | timSort |
insertionSort / insertionSortInfo | Insertion sort or its study result | insertionSort |
shellSort / shellSortInfo | Shell sort or its study result | shellSort |
selectionSort / selectionSortInfo | Selection sort or its study result | selectionSort |
bubbleSort / bubbleSortInfo | Immediate bubble sort or study result with semantic metrics | Bubble sort |
shakerSort / shakerSortInfo | Bidirectional bubble sort or its study result | shakerSort |
quickselect | Select the k-th smallest value without fully sorting the array | quickselect |
binarySearch | Binary search over an ascending integer array | binarySearch |
interpolationSearch | Distribution-aware search over a uniformly distributed integer array | interpolationSearch |
exponentialSearch | Search an ascending integer array by exponentially expanding its range | exponentialSearch |
kmpSearch | Exact substring search with prefix preprocessing | kmpSearch |
zAlgorithm | Prefix-match preprocessing for a string | zAlgorithm |
rabinKarp | Substring search with a rolling hash | rabinKarp |
boyerMoore | Substring search with the bad-character rule | boyerMoore |
ahoCorasick | Multiple-pattern search returning pattern matches | ahoCorasick |
levenshtein | Edit distance between two strings | levenshtein |
Trie | Prefix tree for string words | Trie |
suffixArray | Lexicographic suffix array construction for strings | suffixArray |
SuffixTree | Suffix tree built with Ukkonen's algorithm, with lexicographic suffix array extraction | suffixTreeUkkonen |
Lca | Lowest common ancestor tables over a tree with O(log n) queries | lcaBinaryLifting |
Hld | Heavy-light decomposition with O(log n) chain path queries | heavyLightDecomposition |
Centroid | Centroid decomposition with O(log n) centroid-tree depth | centroidDecomposition |
LinkedList<T> | Singly linked list | LinkedList |
DoubleLinkedList<T> | Doubly linked list | DoubleLinkedList |
AvlTree<T> | Self-balancing AVL tree (ordered set) | AvlTree |
RedBlackTree<T> | Self-balancing red-black tree (ordered set) | RedBlackTree |
SplayTree<T> | Self-adjusting splay tree (ordered set) | SplayTree |
Treap<T> | Randomized treap (ordered set) | Treap |
SortedSet<T> | Ordered set backed by a balanced binary search tree | SortedSet |
SkipList<T> | Randomized skip list (ordered set) | SkipList |
SortedMap<K, V> | Ordered key → value map backed by a balanced binary search tree | SortedMap |
