Union-Find — Two Optimizations Make It Practically Constant

Union-Find gives each group a root representative and decides whether two elements share a group. The unoptimized version stretches find to O(N) on chain trees; path compression and union by rank make it practically constant.

July 4, 2026 · 5 min read

Topological Sort — Process Zero In-degree First

Kahn’s BFS for topological sort repeatedly takes nodes with zero in-degree, and cycle detection comes along without extra logic. The mechanism, the Course Schedule problems, and the selection criteria against DFS post-order.

July 3, 2026 · 5 min read