Concepts5
βοΈAlgorithmIntermediate
Invariant Maintenance
An invariant is a property you promise to keep true throughout an algorithm, and it is the anchor of both design and correctness proofs.
#invariant#loop invariant#search invariant+12
πTheoryIntermediate
Amortized Analysis
Amortized analysis measures the average cost per operation over a worst-case sequence, not over random inputs.
#amortized analysis#aggregate method#accounting method+12
βοΈAlgorithmIntermediate
Minimum Spanning Tree - Kruskal
Kruskalβs algorithm builds a minimum spanning tree (MST) by sorting all edges by weight and greedily picking the next lightest edge that does not form a cycle.
#kruskal#minimum spanning tree#mst+11
ποΈData StructureIntermediate
DSU with Weighted Edges
A DSU with weighted edges (also called a potential or difference-constraint union-find) maintains relative values between elements while still supporting near-constant-time merges and finds.
#dsu#union-find#weighted edges+11
ποΈData StructureIntermediate
Disjoint Set Union (Union-Find)
Disjoint Set Union (Union-Find) maintains a collection of non-overlapping sets and supports fast merging and membership queries.
#disjoint set union#union-find#path compression+11