Concepts7

⚙️AlgorithmIntermediate

Tree DP - Rerooting Technique

Rerooting (a.k.a. 换根 DP) computes a per-node answer as if each node were the root, in total O(n) time on trees.

#rerooting#tree dp#prefix suffix+11
⚙️AlgorithmIntermediate

Maximum Flow - Dinic's Algorithm

Dinic's algorithm computes maximum flow by repeatedly building a level graph with BFS and sending a blocking flow using DFS.

#dinic#maximum flow#blocking flow+11
⚙️AlgorithmIntermediate

Tree Distances and Diameter

Tree diameter is the longest simple path in a tree and can be found with two BFS/DFS runs.

#tree diameter#tree center#eccentricity+12
⚙️AlgorithmIntermediate

Bridges and Articulation Points

A bridge is an edge whose removal increases the number of connected components; an articulation point is a vertex with the same property.

#bridges#articulation points#cut vertex+12
⚙️AlgorithmIntermediate

DFS - Tree and Graph Properties

Depth-First Search (DFS) assigns each vertex a discovery time and a finish time that capture a neat nesting structure of recursion.

#dfs#timestamps#discovery time+11
⚙️AlgorithmIntermediate

Depth-First Search (DFS)

Depth-First Search (DFS) explores a graph by going as deep as possible along each path before backtracking.

#depth-first search#dfs#graph traversal+12
⚙️AlgorithmIntermediate

Complete Search and Backtracking

Complete search enumerates every candidate solution, while backtracking prunes branches that cannot possibly lead to a valid or better solution.

#complete search#backtracking#recursion+12