CP-Algorithms
follow
./index.html
Page Authors
follow
https://github.com/e-maxx-eng/e-maxx-eng/commits/master/src/index.md
http://e-maxx.ru/algo
nofollow
http://e-maxx.ru/algo
https://cp-algorithms-brasil.com
nofollow
https://cp-algorithms-brasil.com
Binary Exponentiation
nofollow
./algebra/binary-exp.html
Euclidean algorithm for computing the greatest common divisor
nofollow
./algebra/euclid-algorithm.html
Extended Euclidean Algorithm
nofollow
./algebra/extended-euclid-algorithm.html
Linear Diophantine Equations
nofollow
./algebra/linear-diophantine-equation.html
Fibonacci Numbers
nofollow
./algebra/fibonacci-numbers.html
Sieve of Eratosthenes
nofollow
./algebra/sieve-of-eratosthenes.html
Sieve of Eratosthenes With Linear Time Complexity
nofollow
./algebra/prime-sieve-linear.html
Primality tests
nofollow
./algebra/primality_tests.html
Integer factorization
nofollow
./algebra/factorization.html
Euler"s totient function
nofollow
./algebra/phi-function.html
Number of divisors / sum of divisors
nofollow
./algebra/divisors.html
Modular Inverse
nofollow
./algebra/module-inverse.html
Linear Congruence Equation
nofollow
./algebra/linear_congruence_equation.html
Chinese Remainder Theorem
nofollow
./algebra/chinese-remainder-theorem.html
Factorial modulo \(p\)
nofollow
./algebra/factorial-modulo.html
Discrete Log
nofollow
./algebra/discrete-log.html
Primitive Root
nofollow
./algebra/primitive-root.html
Discrete Root
nofollow
./algebra/discrete-root.html
Montgomery Multiplication
nofollow
./algebra/montgomery_multiplication.html
Balanced Ternary
nofollow
./algebra/balanced-ternary.html
Gray code
nofollow
./algebra/gray-code.html
Enumerating submasks of a bitmask
nofollow
./algebra/all-submasks.html
Arbitrary-Precision Arithmetic
nofollow
./algebra/big-integer.html
Fast Fourier transform
nofollow
./algebra/fft.html
Operations on polynomials and series
nofollow
./algebra/polynomial.html
Minimum Stack / Minimum Queue
nofollow
./data_structures/stack_queue_modification.html
Sparse Table
nofollow
./data_structures/sparse-table.html
Disjoint Set Union
nofollow
./data_structures/disjoint_set_union.html
Fenwick Tree
nofollow
./data_structures/fenwick.html
Sqrt Decomposition
nofollow
./data_structures/sqrt_decomposition.html
Segment Tree
nofollow
./data_structures/segment_tree.html
Treap
nofollow
./data_structures/treap.html
Sqrt Tree
nofollow
./data_structures/sqrt-tree.html
Randomized Heap
nofollow
./data_structures/randomized_heap.html
Deleting from a data structure in O(T(n)log n)
nofollow
./data_structures/deleting_in_log_n.html
Divide and Conquer DP
nofollow
./dynamic_programming/divide-and-conquer-dp.html
Dynamic Programming on Broken Profile. Problem "Parquet"
nofollow
./dynamic_programming/profile-dynamics.html
Finding the largest zero submatrix
nofollow
./dynamic_programming/zero_matrix.html
String Hashing
nofollow
./string/string-hashing.html
Rabin-Karp for String Matching
nofollow
./string/rabin-karp.html
Prefix function - Knuth-Morris-Pratt
nofollow
./string/prefix-function.html
Z-function
nofollow
./string/z-function.html
Suffix Array
nofollow
./string/suffix-array.html
Aho-Corasick algorithm
nofollow
./string/aho_corasick.html
Suffix Tree
nofollow
./string/suffix-tree-ukkonen.html
Suffix Automaton
nofollow
./string/suffix-automaton.html
Lyndon factorization
nofollow
./string/lyndon_factorization.html
Expression parsing
nofollow
./string/expression_parsing.html
Manacher"s Algorithm - Finding all sub-palindromes in O(N)
nofollow
./string/manacher.html
Finding repetitions
nofollow
./string/main_lorentz.html
Gauss & System of Linear Equations
nofollow
./linear_algebra/linear-system-gauss.html
Gauss & Determinant
nofollow
./linear_algebra/determinant-gauss.html
Kraut & Determinant
nofollow
./linear_algebra/determinant-kraut.html
Rank of a matrix
nofollow
./linear_algebra/rank-matrix.html
Finding Power of Factorial Divisor
nofollow
./algebra/factorial-divisors.html
Binomial Coefficients
nofollow
./combinatorics/binomial-coefficients.html
Catalan Numbers
nofollow
./combinatorics/catalan-numbers.html
The Inclusion-Exclusion Principle
nofollow
./combinatorics/inclusion-exclusion.html
Burnside"s lemma / Pólya enumeration theorem
nofollow
./combinatorics/burnside.html
Stars and bars
nofollow
./combinatorics/stars_and_bars.html
Generating all \(K\)-combinations
nofollow
./combinatorics/generating_combinations.html
Placing Bishops on a Chessboard
nofollow
./combinatorics/bishops-on-chessboard.html
Balanced bracket sequences
nofollow
./combinatorics/bracket_sequences.html
Counting labeled graphs
nofollow
./combinatorics/counting_labeled_graphs.html
Ternary Search
nofollow
./num_methods/ternary_search.html
Newton"s method for finding roots
nofollow
./num_methods/roots_newton.html
Integration by Simpson"s formula
nofollow
./num_methods/simpson-integration.html
Basic Geometry
nofollow
./geometry/basic-geometry.html
Finding the equation of a line for a segment
nofollow
./geometry/segment-to-line.html
Intersection Point of Lines
nofollow
./geometry/lines-intersection.html
Check if two segments intersect
nofollow
./geometry/check-segments-intersection.html
Intersection of Segments
nofollow
./geometry/segments-intersection.html
Circle-Line Intersection
nofollow
./geometry/circle-line-intersection.html
Circle-Circle Intersection
nofollow
./geometry/circle-circle-intersection.html
Common tangents to two circles
nofollow
./geometry/tangents-to-two-circles.html
Length of the union of segments
nofollow
./geometry/length-of-segments-union.html
Oriented area of a triangle
nofollow
./geometry/oriented-triangle-area.html
Area of simple polygon
nofollow
./geometry/area-of-simple-polygon.html
Check if points belong to the convex polygon in O(log N)
nofollow
./geometry/point-in-convex-polygon.html
Minkowski sum of convex polygons
nofollow
./geometry/minkowski.html
Pick"s Theorem - area of lattice polygons
nofollow
./geometry/picks-theorem.html
Lattice points of non-lattice polygon
nofollow
./geometry/lattice-points.html
Convex hull construction using Graham"s Scan
nofollow
./geometry/grahams-scan-convex-hull.html
Convex hull trick and Li Chao tree
nofollow
./geometry/convex_hull_trick.html
Search for a pair of intersecting segments
nofollow
./geometry/intersecting_segments.html
Point location in O(log N)
nofollow
./geometry/point-location.html
Finding the nearest pair of points
nofollow
./geometry/nearest_points.html
Delaunay triangulation and Voronoi diagram
nofollow
./geometry/delaunay.html
Vertical decomposition
nofollow
./geometry/vertical_decomposition.html
Half-plane intersection - S&I Algorithm in O(Nlog N)
nofollow
./geometry/halfplane-intersection.html
Breadth First Search
nofollow
./graph/breadth-first-search.html
Depth First Search
nofollow
./graph/depth-first-search.html
Finding Connected Components
nofollow
./graph/search-for-connected-components.html
Finding Bridges in O(N+M)
nofollow
./graph/bridge-searching.html
Finding Bridges Online
nofollow
./graph/bridge-searching-online.html
Finding Articulation Points in O(N+M)
nofollow
./graph/cutpoints.html
Strongly Connected Components and Condensation Graph
nofollow
./graph/strongly-connected-components.html
Strong Orientation
nofollow
./graph/strong-orientation.html
Dijkstra - finding shortest paths from given vertex
nofollow
./graph/dijkstra.html
Dijkstra on sparse graphs
nofollow
./graph/dijkstra_sparse.html
Bellman-Ford - finding shortest paths with negative weights
nofollow
./graph/bellman_ford.html
0-1 BFS
nofollow
./graph/01_bfs.html
D´Esopo-Pape algorithm
nofollow
./graph/desopo_pape.html
Floyd-Warshall - finding all shortest paths
nofollow
./graph/all-pair-shortest-path-floyd-warshall.html
Number of paths of fixed length / Shortest paths of fixed length
nofollow
./graph/fixed_length_paths.html
Minimum Spanning Tree - Prim"s Algorithm
nofollow
./graph/mst_prim.html
Minimum Spanning Tree - Kruskal
nofollow
./graph/mst_kruskal.html
Minimum Spanning Tree - Kruskal with Disjoint Set Union
nofollow
./graph/mst_kruskal_with_dsu.html
Second best Minimum Spanning Tree - Using Kruskal and Lowest Common Ancestor
nofollow
./graph/second_best_mst.html
Kirchhoff Theorem
nofollow
./graph/kirchhoff-theorem.html
Prüfer code
nofollow
./graph/pruefer_code.html
Checking a graph for acyclicity and finding a cycle in O(M)
nofollow
./graph/finding-cycle.html
Finding a Negative Cycle in the Graph
nofollow
./graph/finding-negative-cycle-in-graph.html
Eulerian Path
nofollow
./graph/euler_path.html
Lowest Common Ancestor
nofollow
./graph/lca.html
Lowest Common Ancestor - Binary Lifting
nofollow
./graph/lca_binary_lifting.html
Lowest Common Ancestor - Farach-Colton and Bender algorithm
nofollow
./graph/lca_farachcoltonbender.html
Solve RMQ by finding LCA
nofollow
./graph/rmq_linear.html
Lowest Common Ancestor - Tarjan"s off-line algorithm
nofollow
./graph/lca_tarjan.html
Maximum flow - Ford-Fulkerson and Edmonds-Karp
nofollow
./graph/edmonds_karp.html
Maximum flow - Push-relabel algorithm
nofollow
./graph/push-relabel.html
Maximum flow - Push-relabel algorithm improved
nofollow
./graph/push-relabel-faster.html
Maximum flow - Dinic"s algorithm
nofollow
./graph/dinic.html
Maximum flow - MPM algorithm
nofollow
./graph/mpm.html
Flows with demands
nofollow
./graph/flow_with_demands.html
Minimum-cost flow
nofollow
./graph/min_cost_flow.html
Assignment problem. Solution using min-cost-flow in O (N^5)
nofollow
./graph/Assignment-problem-min-flow.html
Bipartite Graph Check
nofollow
./graph/bipartite-check.html
Kuhn" Algorithm - Maximum Bipartite Matching
nofollow
./graph/kuhn_maximum_bipartite_matching.html
Topological Sorting
nofollow
./graph/topological-sort.html
Edge connectivity / Vertex connectivity
nofollow
./graph/edge_vertex_connectivity.html
Tree painting
nofollow
./graph/tree_painting.html
2-SAT
nofollow
./graph/2SAT.html
Heavy-light decomposition
nofollow
./graph/hld.html
RMQ task (Range Minimum Query - the smallest element in an interval)
nofollow
./sequences/rmq.html
Longest increasing subsequence
nofollow
./sequences/longest_increasing_subsequence.html
Search the subsegment with the maximum/minimum sum
nofollow
./others/maximum_average_segment.html
K-th order statistic in O(N)
nofollow
./sequences/k-th.html
Games on arbitrary graphs
nofollow
./game_theory/games_on_graphs.html
Sprague-Grundy theorem. Nim
nofollow
./game_theory/sprague-grundy-nim.html
Scheduling jobs on one machine
nofollow
./schedules/schedule_one_machine.html
Scheduling jobs on two machines
nofollow
./schedules/schedule_two_machines.html
Optimal schedule of jobs given their deadlines and durations
nofollow
./schedules/schedule-with-completion-duration.html
Josephus problem
nofollow
./others/josephus_problem.html
15 Puzzle Game: Existence Of The Solution
nofollow
./others/15-puzzle.html
The Stern-Brocot Tree and Farey Sequences
nofollow
./others/stern_brocot_tree_farey_sequences.html
Information for contributors
nofollow
./contrib.html
Test-Your-Page form
nofollow
./preview.html
http://github.com/e-maxx-eng
follow
http://github.com/e-maxx-eng