Topological ordering exposes dependencies in a directed acyclic graph
A topological ordering places each prerequisite before the tasks that depend on it. Such an ordering exists for […]
A topological ordering places each prerequisite before the tasks that depend on it. Such an ordering exists for […]
Depth-first search follows a branch as far as it can before exploring alternatives. A tree has a built-in […]
Breadth-first search explores a graph in increasing numbers of edges from a starting vertex. With equal edge costs, […]
A set represents which distinct values are present. A map associates each key with a value. Choosing between […]
A prefix-sum array stores cumulative totals so that the sum of a contiguous range can be recovered by […]
A sorting routine depends on a comparison rule that behaves consistently across all input records. A rule that […]
A stable sorting algorithm preserves the original relative order of records whose sort keys compare equal. This matters […]
A recursive function solves a problem by calling itself on a smaller instance. Correctness depends on knowing when […]
A loop invariant is a statement that remains true whenever execution returns to the start of a loop. […]
A greedy algorithm makes the best-looking choice at each step and never looks back. It is fast and […]