

Scaling operation: multiplies each of the coordinates by a different constant.A step-by-step guide for using the Lattice Method for Multiplying!.Shift operation: adds a different constant to each of the coordinates.Solution: Let's look at how the different types of transformations change the coordinates: You should apply all transformations faster than $O(n \cdot length)$, where $length$ is the total number of transformations to be applied (after unrolling "loop" operations). There is also a "loop" operation which applies a given list of transformations $k$ times ("loop" operations can be nested). Each transformation can be a shift, a scaling or a rotation around a given axis by a given angle. Problem: Given $n$ points $p_i$, apply $m$ transformations to each of these points. Fast application of a set of geometric operations to a set of points You could then compute $k$ modulo the size of the cycle and find the final position for each number which is part of this cycle. Note: This task can be solved more efficiently in linear time by building the permutation graph and considering each cycle independently. Long long binpow ( long long a, long long b, long long m ) The Stern-Brocot Tree and Farey Sequences 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) Variation of binary exponentiation: multiplying two numbers modulo mĮuclidean algorithm for computing the greatest common divisorĭeleting from a data structure in O(T(n) log n)ĭynamic Programming on Broken Profile. Effective computation of large exponents modulo a numberĮffective computation of Fibonacci numbersįast application of a set of geometric operations to a set of points
