- Dynamic programming
- Define the state, transition, base cases, and evaluation order. Practice knapsack, grid paths, increasing subsequences, and DP over subsets, intervals, or digits.
- Graph algorithms
- Use BFS for unweighted paths and Dijkstra for nonnegative weights. Order DAG dependencies with topological sort. Use disjoint sets to maintain connectivity and to implement Kruskal’s minimum spanning tree algorithm.
- Range data structures
- Use Fenwick or segment trees for point updates and range queries, ordered sets for predecessor and successor queries, and stacks or sliding windows when elements can be removed in a predictable order.
- Tree algorithms
- Combine subtree states and reroot to compute answers for every possible root. Flatten subtrees with Euler order and connect lowest common ancestor queries to range minimum queries.
- Math and search
- Use divisibility, modular arithmetic, and combinatorial counting. Explore hashing, meet-in-the-middle, and searching unimodal functions when their assumptions match the problem.