|
1 | 1 | ---
|
2 | 2 | title: Main Page
|
3 | 3 | ---
|
4 |
| -# Algorithms for Competitive Programming |
5 | 4 |
|
6 |
| -*The goal of this project is to translate the wonderful resource |
7 |
| -[http://e-maxx.ru/algo](http://e-maxx.ru/algo) which provides descriptions of many algorithms |
8 |
| -and data structures especially popular in field of competitive programming. |
9 |
| -Moreover we want to improve the collected knowledge by extending the articles |
10 |
| -and adding new articles to the collection.* |
11 |
| - |
12 |
| -## Changelog |
13 |
| - |
14 |
| - |
15 |
| -- June 5, 2022: Enabled content tabs and sidebar navigation. The navigation structure should be adjusted in [mkdocs.yml](https://github.com/e-maxx-eng/e-maxx-eng/blob/master/mkdocs.yml) whenever a new article is created or an old one is moved. |
16 |
| -- January 16, 2022: Switched to the [MkDocs](https://www.mkdocs.org/) site generator with the [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) theme, which give the website a more modern look, brings a couple of new features (dark mode, better search, ...), makes the website more stable (in terms of rendering math formulas), and makes it easier to contribute. |
17 |
| - |
18 |
| -## New articles |
19 |
| - |
20 |
| -- (12 May 2022) [Factoring Exponentiation](algebra/factoring-exp.md) |
21 |
| -- (7 May 2022) [Knuth's Optimization](dynamic_programming/knuth-optimization.md) |
22 |
| -- (31 March 2022) [Continued fractions](algebra/continued-fractions.md) |
23 |
| - |
24 |
| -Full list of updates: [Commit History](https://github.com/e-maxx-eng/e-maxx-eng/commits/master) |
25 |
| - |
26 |
| -## Contributing |
27 |
| - |
28 |
| -- [Information for contributors](contrib.md) |
29 |
| -- [Test-Your-Page form](preview.md) |
30 |
| - |
31 |
| ---- |
32 |
| - |
33 |
| -## Articles |
34 |
| - |
35 |
| -### Algebra |
36 |
| - |
37 |
| -- **Fundamentals** |
38 |
| - - [Binary Exponentiation](algebra/binary-exp.md) |
39 |
| - - [Factoring Exponentiation](algebra/factoring-exp.md) |
40 |
| - - [Euclidean algorithm for computing the greatest common divisor](algebra/euclid-algorithm.md) |
41 |
| - - [Extended Euclidean Algorithm](algebra/extended-euclid-algorithm.md) |
42 |
| - - [Linear Diophantine Equations](algebra/linear-diophantine-equation.md) |
43 |
| - - [Fibonacci Numbers](algebra/fibonacci-numbers.md) |
44 |
| -- **Prime numbers** |
45 |
| - - [Sieve of Eratosthenes](algebra/sieve-of-eratosthenes.md) |
46 |
| - - [Linear Sieve](algebra/prime-sieve-linear.md) |
47 |
| - - [Primality tests](algebra/primality_tests.md) |
48 |
| - - [Integer factorization](algebra/factorization.md) |
49 |
| -- **Number-theoretic functions** |
50 |
| - - [Euler's totient function](algebra/phi-function.md) |
51 |
| - - [Number of divisors / sum of divisors](algebra/divisors.md) |
52 |
| -- **Modular arithmetic** |
53 |
| - - [Modular Inverse](algebra/module-inverse.md) |
54 |
| - - [Linear Congruence Equation](algebra/linear_congruence_equation.md) |
55 |
| - - [Chinese Remainder Theorem](algebra/chinese-remainder-theorem.md) |
56 |
| - - [Factorial modulo $p$](algebra/factorial-modulo.md) |
57 |
| - - [Discrete Log](algebra/discrete-log.md) |
58 |
| - - [Primitive Root](algebra/primitive-root.md) |
59 |
| - - [Discrete Root](algebra/discrete-root.md) |
60 |
| - - [Montgomery Multiplication](algebra/montgomery_multiplication.md) |
61 |
| -- **Number systems** |
62 |
| - - [Balanced Ternary](algebra/balanced-ternary.md) |
63 |
| - - [Gray code](algebra/gray-code.md) |
64 |
| -- **Miscellaneous** |
65 |
| - - [Enumerating submasks of a bitmask](algebra/all-submasks.md) |
66 |
| - - [Arbitrary-Precision Arithmetic](algebra/big-integer.md) |
67 |
| - - [Fast Fourier transform](algebra/fft.md) |
68 |
| - - [Operations on polynomials and series](algebra/polynomial.md) |
69 |
| - - [Continued fractions](algebra/continued-fractions.md) |
70 |
| - |
71 |
| -### Data Structures |
72 |
| - |
73 |
| -- **Fundamentals** |
74 |
| - - [Minimum Stack / Minimum Queue](data_structures/stack_queue_modification.md) |
75 |
| - - [Sparse Table](data_structures/sparse-table.md) |
76 |
| -- **Trees** |
77 |
| - - [Disjoint Set Union](data_structures/disjoint_set_union.md) |
78 |
| - - [Fenwick Tree](data_structures/fenwick.md) |
79 |
| - - [Sqrt Decomposition](data_structures/sqrt_decomposition.md) |
80 |
| - - [Segment Tree](data_structures/segment_tree.md) |
81 |
| - - [Treap](data_structures/treap.md) |
82 |
| - - [Sqrt Tree](data_structures/sqrt-tree.md) |
83 |
| - - [Randomized Heap](data_structures/randomized_heap.md) |
84 |
| -- **Advanced** |
85 |
| - - [Deleting from a data structure in O(T(n)log n)](data_structures/deleting_in_log_n.md) |
86 |
| - |
87 |
| -### Dynamic Programming |
88 |
| - |
89 |
| -- **DP optimizations** |
90 |
| - - [Divide and Conquer DP](dynamic_programming/divide-and-conquer-dp.md) |
91 |
| - - [Knuth's Optimization](dynamic_programming/knuth-optimization.md) |
92 |
| -- **Tasks** |
93 |
| - - [Dynamic Programming on Broken Profile. Problem "Parquet"](dynamic_programming/profile-dynamics.md) |
94 |
| - - [Finding the largest zero submatrix](dynamic_programming/zero_matrix.md) |
95 |
| - |
96 |
| -### String Processing |
97 |
| - |
98 |
| -- **Fundamentals** |
99 |
| - - [String Hashing](string/string-hashing.md) |
100 |
| - - [Rabin-Karp for String Matching](string/rabin-karp.md) |
101 |
| - - [Prefix function - Knuth-Morris-Pratt](string/prefix-function.md) |
102 |
| - - [Z-function](string/z-function.md) |
103 |
| - - [Suffix Array](string/suffix-array.md) |
104 |
| - - [Aho-Corasick algorithm](string/aho_corasick.md) |
105 |
| -- **Advanced** |
106 |
| - - [Suffix Tree](string/suffix-tree-ukkonen.md) |
107 |
| - - [Suffix Automaton](string/suffix-automaton.md) |
108 |
| - - [Lyndon factorization](string/lyndon_factorization.md) |
109 |
| -- **Tasks** |
110 |
| - - [Expression parsing](string/expression_parsing.md) |
111 |
| - - [Manacher's Algorithm - Finding all sub-palindromes in O(N)](string/manacher.md) |
112 |
| - - [Finding repetitions](string/main_lorentz.md) |
113 |
| - |
114 |
| -### Linear Algebra |
115 |
| - |
116 |
| -- **Matrices** |
117 |
| - - [Gauss & System of Linear Equations](linear_algebra/linear-system-gauss.md) |
118 |
| - - [Gauss & Determinant](linear_algebra/determinant-gauss.md) |
119 |
| - - [Kraut & Determinant](linear_algebra/determinant-kraut.md) |
120 |
| - - [Rank of a matrix](linear_algebra/rank-matrix.md) |
121 |
| - |
122 |
| -### Combinatorics |
123 |
| - |
124 |
| -- **Fundamentals** |
125 |
| - - [Finding Power of Factorial Divisor](algebra/factorial-divisors.md) |
126 |
| - - [Binomial Coefficients](combinatorics/binomial-coefficients.md) |
127 |
| - - [Catalan Numbers](combinatorics/catalan-numbers.md) |
128 |
| -- **Techniques** |
129 |
| - - [The Inclusion-Exclusion Principle](combinatorics/inclusion-exclusion.md) |
130 |
| - - [Burnside's lemma / Pólya enumeration theorem](combinatorics/burnside.md) |
131 |
| - - [Stars and bars](combinatorics/stars_and_bars.md) |
132 |
| - - [Generating all $K$-combinations](combinatorics/generating_combinations.md) |
133 |
| -- **Tasks** |
134 |
| - - [Placing Bishops on a Chessboard](combinatorics/bishops-on-chessboard.md) |
135 |
| - - [Balanced bracket sequences](combinatorics/bracket_sequences.md) |
136 |
| - - [Counting labeled graphs](combinatorics/counting_labeled_graphs.md) |
137 |
| - |
138 |
| -### Numerical Methods |
139 |
| - |
140 |
| -- **Search** |
141 |
| - - [Ternary Search](num_methods/ternary_search.md) |
142 |
| - - [Newton's method for finding roots](num_methods/roots_newton.md) |
143 |
| -- **Integration** |
144 |
| - - [Integration by Simpson's formula](num_methods/simpson-integration.md) |
145 |
| - |
146 |
| -### Geometry |
147 |
| - |
148 |
| -- **Elementary operations** |
149 |
| - - [Basic Geometry](geometry/basic-geometry.md) |
150 |
| - - [Finding the equation of a line for a segment](geometry/segment-to-line.md) |
151 |
| - - [Intersection Point of Lines](geometry/lines-intersection.md) |
152 |
| - - [Check if two segments intersect](geometry/check-segments-intersection.md) |
153 |
| - - [Intersection of Segments](geometry/segments-intersection.md) |
154 |
| - - [Circle-Line Intersection](geometry/circle-line-intersection.md) |
155 |
| - - [Circle-Circle Intersection](geometry/circle-circle-intersection.md) |
156 |
| - - [Common tangents to two circles](geometry/tangents-to-two-circles.md) |
157 |
| - - [Length of the union of segments](geometry/length-of-segments-union.md) |
158 |
| -- **Polygons** |
159 |
| - - [Oriented area of a triangle](geometry/oriented-triangle-area.md) |
160 |
| - - [Area of simple polygon](geometry/area-of-simple-polygon.md) |
161 |
| - - [Check if points belong to the convex polygon in O(log N)](geometry/point-in-convex-polygon.md) |
162 |
| - - [Minkowski sum of convex polygons](geometry/minkowski.md) |
163 |
| - - [Pick's Theorem - area of lattice polygons](geometry/picks-theorem.md) |
164 |
| - - [Lattice points of non-lattice polygon](geometry/lattice-points.md) |
165 |
| -- **Convex hull** |
166 |
| - - [Convex hull construction](geometry/convex-hull.md) |
167 |
| - - [Convex hull trick and Li Chao tree](geometry/convex_hull_trick.md) |
168 |
| -- **Sweep-line** |
169 |
| - - [Search for a pair of intersecting segments](geometry/intersecting_segments.md) |
170 |
| - - [Point location in O(log N)](geometry/point-location.md) |
171 |
| -- **Miscellaneous** |
172 |
| - - [Finding the nearest pair of points](geometry/nearest_points.md) |
173 |
| - - [Delaunay triangulation and Voronoi diagram](geometry/delaunay.md) |
174 |
| - - [Vertical decomposition](geometry/vertical_decomposition.md) |
175 |
| - - [Half-plane intersection - S&I Algorithm in O(Nlog N)](geometry/halfplane-intersection.md) |
176 |
| - |
177 |
| -### Graphs |
178 |
| - |
179 |
| -- **Graph traversal** |
180 |
| - - [Breadth First Search](graph/breadth-first-search.md) |
181 |
| - - [Depth First Search](graph/depth-first-search.md) |
182 |
| -- **Connected components, bridges, articulations points** |
183 |
| - - [Finding Connected Components](graph/search-for-connected-components.md) |
184 |
| - - [Finding Bridges in O(N+M)](graph/bridge-searching.md) |
185 |
| - - [Finding Bridges Online](graph/bridge-searching-online.md) |
186 |
| - - [Finding Articulation Points in O(N+M)](graph/cutpoints.md) |
187 |
| - - [Strongly Connected Components and Condensation Graph](graph/strongly-connected-components.md) |
188 |
| - - [Strong Orientation](graph/strong-orientation.md) |
189 |
| -- **Single-source shortest paths** |
190 |
| - - [Dijkstra - finding shortest paths from given vertex](graph/dijkstra.md) |
191 |
| - - [Dijkstra on sparse graphs](graph/dijkstra_sparse.md) |
192 |
| - - [Bellman-Ford - finding shortest paths with negative weights](graph/bellman_ford.md) |
193 |
| - - [0-1 BFS](graph/01_bfs.md) |
194 |
| - - [D´Esopo-Pape algorithm](graph/desopo_pape.md) |
195 |
| -- **All-pairs shortest paths** |
196 |
| - - [Floyd-Warshall - finding all shortest paths](graph/all-pair-shortest-path-floyd-warshall.md) |
197 |
| - - [Number of paths of fixed length / Shortest paths of fixed length](graph/fixed_length_paths.md) |
198 |
| -- **Spanning trees** |
199 |
| - - [Minimum Spanning Tree - Prim's Algorithm](graph/mst_prim.md) |
200 |
| - - [Minimum Spanning Tree - Kruskal](graph/mst_kruskal.md) |
201 |
| - - [Minimum Spanning Tree - Kruskal with Disjoint Set Union](graph/mst_kruskal_with_dsu.md) |
202 |
| - - [Second best Minimum Spanning Tree - Using Kruskal and Lowest Common Ancestor](graph/second_best_mst.md) |
203 |
| - - [Kirchhoff Theorem](graph/kirchhoff-theorem.md) |
204 |
| - - [Prüfer code](graph/pruefer_code.md) |
205 |
| -- **Cycles** |
206 |
| - - [Checking a graph for acyclicity and finding a cycle in O(M)](graph/finding-cycle.md) |
207 |
| - - [Finding a Negative Cycle in the Graph](graph/finding-negative-cycle-in-graph.md) |
208 |
| - - [Eulerian Path](graph/euler_path.md) |
209 |
| -- **Lowest common ancestor** |
210 |
| - - [Lowest Common Ancestor](graph/lca.md) |
211 |
| - - [Lowest Common Ancestor - Binary Lifting](graph/lca_binary_lifting.md) |
212 |
| - - [Lowest Common Ancestor - Farach-Colton and Bender algorithm](graph/lca_farachcoltonbender.md) |
213 |
| - - [Solve RMQ by finding LCA](graph/rmq_linear.md) |
214 |
| - - [Lowest Common Ancestor - Tarjan's off-line algorithm](graph/lca_tarjan.md) |
215 |
| -- **Flows and related problems** |
216 |
| - - [Maximum flow - Ford-Fulkerson and Edmonds-Karp](graph/edmonds_karp.md) |
217 |
| - - [Maximum flow - Push-relabel algorithm](graph/push-relabel.md) |
218 |
| - - [Maximum flow - Push-relabel algorithm improved](graph/push-relabel-faster.md) |
219 |
| - - [Maximum flow - Dinic's algorithm](graph/dinic.md) |
220 |
| - - [Maximum flow - MPM algorithm](graph/mpm.md) |
221 |
| - - [Flows with demands](graph/flow_with_demands.md) |
222 |
| - - [Minimum-cost flow](graph/min_cost_flow.md) |
223 |
| - - [Assignment problem. Solution using min-cost-flow in O (N^5)](graph/Assignment-problem-min-flow.md) |
224 |
| -- **Matchings and related problems** |
225 |
| - - [Bipartite Graph Check](graph/bipartite-check.md) |
226 |
| - - [Kuhn's Algorithm - Maximum Bipartite Matching](graph/kuhn_maximum_bipartite_matching.md) |
227 |
| -- **Miscellaneous** |
228 |
| - - [Topological Sorting](graph/topological-sort.md) |
229 |
| - - [Edge connectivity / Vertex connectivity](graph/edge_vertex_connectivity.md) |
230 |
| - - [Tree painting](graph/tree_painting.md) |
231 |
| - - [2-SAT](graph/2SAT.md) |
232 |
| - - [Heavy-light decomposition](graph/hld.md) |
233 |
| - |
234 |
| -### Miscellaneous |
235 |
| - |
236 |
| -- **Sequences** |
237 |
| - - [RMQ task (Range Minimum Query - the smallest element in an interval)](sequences/rmq.md) |
238 |
| - - [Longest increasing subsequence](sequences/longest_increasing_subsequence.md) |
239 |
| - - [Search the subsegment with the maximum/minimum sum](others/maximum_average_segment.md) |
240 |
| - - [K-th order statistic in O(N)](sequences/k-th.md) |
241 |
| -- **Game Theory** |
242 |
| - - [Games on arbitrary graphs](game_theory/games_on_graphs.md) |
243 |
| - - [Sprague-Grundy theorem. Nim](game_theory/sprague-grundy-nim.md) |
244 |
| -- **Schedules** |
245 |
| - - [Scheduling jobs on one machine](schedules/schedule_one_machine.md) |
246 |
| - - [Scheduling jobs on two machines](schedules/schedule_two_machines.md) |
247 |
| - - [Optimal schedule of jobs given their deadlines and durations](schedules/schedule-with-completion-duration.md) |
248 |
| -- **Miscellaneous** |
249 |
| - - [Josephus problem](others/josephus_problem.md) |
250 |
| - - [15 Puzzle Game: Existence Of The Solution](others/15-puzzle.md) |
251 |
| - - [The Stern-Brocot Tree and Farey Sequences](others/stern_brocot_tree_farey_sequences.md) |
| 5 | +{% include 'index_body' %} |
0 commit comments