Concepts5
⚙️AlgorithmIntermediate
Constructive Algorithm Techniques
Constructive algorithms build a valid answer directly by following a recipe, rather than searching exhaustively.
#constructive algorithm#greedy construction#invariant+12
⚙️AlgorithmIntermediate
Proof Techniques for Greedy Algorithms
Greedy algorithm correctness is usually proved with patterns like exchange argument, stays-ahead, structural arguments, cut-and-paste, and contradiction.
#greedy algorithms#exchange argument#stays ahead+12
⚙️AlgorithmIntermediate
Exchange Arguments in DP
An exchange argument proves that any optimal solution can be reordered to satisfy a simple sorting rule by showing that swapping adjacent out-of-order elements never helps.
#exchange argument#adjacent swap#smith rule+12
⚙️AlgorithmIntermediate
Greedy - Exchange Argument
The exchange argument proves a greedy algorithm is optimal by swapping out-of-order choices in any supposed optimal solution until it matches the greedy one without making it worse.
#greedy#exchange argument#pairwise swap+12
⚙️AlgorithmIntermediate
Greedy Algorithms
Greedy algorithms build a solution step by step by always taking the best local choice available.
#greedy algorithms#activity selection#interval scheduling+12