How Kuhn matches by augmenting DFS

Short answer: Kuhn’s algorithm builds a bipartite matching by a depth-first search for one augmenting path at a time. Each free left vertex tries to find an alternating path to a free right vertex, flipping the matching if it succeeds. With a visited mark cleared every search, the time…

How Kruskal adds the cheapest safe edge

Short answer: Kruskal’s algorithm sorts the undirected edges by weight and adds an edge when its ends lie in different trees of a forest. A union-find structure answers that test. The sort dominates, at O(E log E), and the union-find work is essentially linear. The first |V|−1 accepted edges…

How Kosaraju uses a transpose graph

Short answer: Kosaraju’s algorithm finds strongly connected components with two depth-first searches. The first search records vertices in reverse order of finish time on the original graph. The second search runs on the transpose, in which every edge is reversed, and starts vertices in that recorded order. Each tree…

How Karger contracts a random min-cut

Short answer: Karger’s algorithm finds a global minimum cut of an undirected multigraph by randomly contracting edges until two supernodes remain. The edges between those two supernodes are a cut, and each run returns the minimum cut with probability at least 1/binom(n, 2), about 2/n². Repeating O(n² log n)…

How introsort caps quicksort with a heap

Short answer: Introsort runs quicksort until the recursion depth passes about 2 log₂ n, then finishes that slice with heapsort. Short slices drop into insertion sort. The worst case becomes O(n log n), the typical case keeps quicksort’s partition, and the sort stays in place and unstable. This is…