This includes finding the sum of consecutive array elements $a$, or finding the minimum element in a such a range in $O(\log n)$ time.īetween answering such queries, the Segment Tree allows modifying the array by replacing one element, or even changing the elements of a whole subsegment (e.g. This allows answering range queries over an array efficiently, while still being flexible enough to allow quick modification of the array. The Stern-Brocot Tree and Farey SequencesĪ Segment Tree is a data structure that stores information about array intervals as a tree. 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) Preserving the history of its values (Persistent Segment Tree)įinding the k-th smallest number in a rangeĭeleting from a data structure in O(T(n) log n)ĭynamic Programming on Broken Profile. Acceleration with "fractional cascading". With modification queries.įind the smallest number greater or equal to a specified number. No modification queries.įind the smallest number greater or equal to a specified number. Saving the entire subarrays in each vertexįind the smallest number greater or equal to a specified number. Searching for the first element greater than a given amount Searching for an array prefix with a given amount Euclidean algorithm for computing the greatest common divisorįinding the maximum and the number of times it appearsĬompute the greatest common divisor / least common multipleĬounting the number of zeros, searching for the k-th zero
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |