Test boundaries where an algorithm changes its behavior
Boundary cases are inputs near a decision point in the algorithm or in its contract. They often reveal […]
Clear, practical explanations of algorithms, data structures, complexity, and problem-solving patterns.
Boundary cases are inputs near a decision point in the algorithm or in its contract. They often reveal […]
A priority queue retrieves an item with the best priority according to a defined ordering. It is useful […]
Union-find maintains a partition of items into disjoint groups. It supports asking which group contains an item and […]
The same graph can be represented as an adjacency matrix or as adjacency lists. The representation affects both […]
A greedy algorithm makes a locally attractive choice and continues without revisiting that decision. Before relying on that […]
Memoization stores answers when a recursive computation first asks for them. Tabulation fills a collection of answers in […]
Dynamic programming stores solutions to overlapping subproblems so that the same work is not repeated. The difficult design […]
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 […]
A priority queue answers one question quickly: which item is the most urgent right now? A heap is […]
Arrays and linked lists both store sequences, but they make opposite trade-offs about memory layout, and that choice […]
A hash table trades a little memory and some careful design for one of the most useful promises […]
An algorithm that works on the happy path may still fail at the boundaries. Before declaring it finished, test: Empty […]
A stack and a queue both hold items, but they express different kinds of work. Choose a stack when the […]
Big-O notation describes how an algorithm’s work grows as its input grows. O(1): the work stays roughly constant. O(log n): […]
Good algorithm choices become easier when the major patterns are visible in one place. Choral Software has released a free […]
A good data structure does not merely store information. It makes the operation you care about cheap, clear, and difficult […]
Binary search is one of the clearest examples of how a small change in strategy can transform an algorithm. Instead […]