

At each step, the fire burning at each vertex spreads to all of its neighbors. The algorithm can be understood as a fire spreading on the graph: at the zeroth step only the source $s$ is on fire. The input graph can be directed or undirected, The algorithm takes as input an unweighted graph and the id of the source vertex $s$. The algorithm works in $O(n + m)$ time, where $n$ is number of vertices and $m$ is the number of edges. The Stern-Brocot Tree and Farey Sequencesīreadth first search is one of the basic and essential searching algorithms on graphs.Īs a result of how the algorithm works, the path found by breadth first search to any node is the shortest path to that node, i.e the path that contains the smallest number of edges in unweighted graphs. Optimal schedule of jobs given their deadlines and durationsġ5 Puzzle Game: Existence Of The Solution MEX task (Minimal Excluded element in an array) Search the subsegment with the maximum/minimum sum RMQ task (Range Minimum Query - the smallest element in an interval)

Kuhn's Algorithm - Maximum Bipartite Matching Maximum flow - Push-relabel algorithm improved Maximum flow - Ford-Fulkerson and Edmonds-Karp Lowest Common Ancestor - Tarjan's off-line algorithm Lowest Common Ancestor - Farach-Colton and Bender algorithm Second best Minimum Spanning Tree - Using Kruskal and Lowest Common AncestorĬhecking a graph for acyclicity and finding a cycle in O(M) Minimum Spanning Tree - Kruskal with Disjoint Set Union

Number of paths of fixed length / Shortest paths of fixed length Strongly Connected Components and Condensation Graphĭijkstra - finding shortest paths from given vertexīellman-Ford - finding shortest paths with negative weightsįloyd-Warshall - finding all shortest paths Half-plane intersection - S&I Algorithm in O(N log N)Ĭonnected components, bridges, articulations points Search for a pair of intersecting segmentsĭelaunay triangulation and Voronoi diagram Pick's Theorem - area of lattice polygons Manacher's Algorithm - Finding all sub-palindromes in O(N)īurnside's lemma / Pólya enumeration theoremįinding the equation of a line for a segmentĬheck if points belong to the convex polygon in O(log N) Euclidean algorithm for computing the greatest common divisorĭeleting from a data structure in O(T(n) log n)ĭynamic Programming on Broken Profile.
