Algorithms for Competitive ProgrammingThe goal of this project is to translate the wonderful resource http://e-maxx.ru/algo which provides descriptions of many algorithms and data structures especially popular in field of competitive programming. Moreover we want to improve the collected knowledge by extending the articles and adding new articles to the collection.https://cp-algorithms.com/https://github.com/cp-algorithms/cp-algorithmsenSat, 02 Nov 2024 21:59:59 -0000Sat, 02 Nov 2024 21:59:59 -00001440MkDocs RSS plugin - v1.15.0Knapsack Problem<h1>Knapsack Problem</h1><p>Prerequisite knowledge: <a href="https://cp-algorithms.com/dynamic_programming/intro-to-dp.html">Introduction to Dynamic Programming</a></p><h2>Introduc...</h2>https://cp-algorithms.com/dynamic_programming/knapsack.html Sat, 18 May 2024 06:20:41 +0000Manhattan Distance<h1>Manhattan Distance</h1><h2>Definition</h2><p>For points $p$ and $q$ on a plane, we can define the distance between them as the sum of the differences between their $...</p>https://cp-algorithms.com/geometry/manhattan-distance.html Thu, 16 May 2024 19:20:34 +0000Hungarian Algorithm<h1>Hungarian algorithm for solving the assignment problem</h1><h2>Statement of the assignment problem</h2><p>There are several standard formulations of the assignment p...</p>https://cp-algorithms.com/graph/hungarian-algorithm.html Thu, 07 Dec 2023 23:50:44 +0000Introduction to Dynamic Programming<h1>Introduction to Dynamic Programming</h1><p>The essence of dynamic programming is to avoid repeated calculation. Often, dynamic programming problems are naturall...</p>https://cp-algorithms.com/dynamic_programming/intro-to-dp.html Wed, 29 Nov 2023 10:21:39 +0000Tortoise and Hare Algorithm (Linked List cycle detection)<h1>Floyd's Linked List Cycle Finding Algorithm</h1><p>Given a linked list where the starting point of that linked list is denoted by <strong>head</strong>, and there may or may ...</p>https://cp-algorithms.com/others/tortoise_and_hare.html Sun, 10 Sep 2023 08:20:59 +0000Finding faces of a planar graph<h1>Finding faces of a planar graph</h1><p>Consider a graph $G$ with $n$ vertices and $m$ edges, which can be drawn on a plane in such a way that two edges intersect...</p>https://cp-algorithms.com/geometry/planar.html Wed, 12 Jul 2023 15:52:18 +0000Bit manipulation<h1>Bit manipulation</h1><h2>Binary number</h2><p>A <strong>binary number</strong> is a number expressed in the base-2 numeral system or binary numeral system, it is a method of math...</p>https://cp-algorithms.com/algebra/bit-manipulation.html Fri, 31 Mar 2023 02:53:20 +0000Garner's Algorithm<h1>Garner's algorithm</h1><p>A consequence of the <a href="chinese-remainder-theorem.md">Chinese Remainder Theorem</a> is, that we can represent big numbers using an array of ...</p>https://cp-algorithms.com/algebra/garners-algorithm.html Sun, 29 Jan 2023 19:48:33 +0000Code of conduct<h1>Code of conduct</h1><p>We endorse and follow the code of conduct of the International Olympiad of Informatics, available at the [IOI website](https://ioinformati...</p>https://cp-algorithms.com/code_of_conduct.html Tue, 13 Dec 2022 14:21:50 +0000Tag index<h1>Tags</h1><p>This file contains a global index of all tags used on the pages.</p><h2><span class="md-tag">Original</span></h2><ul><li>[Bit manipulation](algebra/bit-manipulat...</li></ul>https://cp-algorithms.com/tags.html Sun, 05 Jun 2022 22:11:56 +0000Navigation<ul><li>Home<ul><li><a href="index.md">Main Page</a></li><li><a href="navigation.md">Navigation</a></li><li><a href="tags.md">Tag index</a></li><li><a href="contrib.md">How to Contribute</a></li><li>[Code of conduct]...</li></ul></li></ul>https://cp-algorithms.com/navigation.html Sun, 05 Jun 2022 18:52:23 +0000Binary Search<h1>Binary search</h1><p><strong>Binary search</strong> is a method that allows for quicker search of something by splitting the search interval into two. Its most common applica...</p>https://cp-algorithms.com/num_methods/binary_search.html Fri, 03 Jun 2022 11:53:41 +0000Knuth's Optimization<h1>Knuth's Optimization</h1><p>Knuth's optimization, also known as the Knuth-Yao Speedup, is a special case of dynamic programming on ranges, that can optimize the ...</p>https://cp-algorithms.com/dynamic_programming/knuth-optimization.html Fri, 29 Apr 2022 09:57:35 +0000Factoring Exponentiation<h1>Binary Exponentiation by Factoring</h1><p>Consider a problem of computing $ax^y \pmod{2^d}$, given integers $a$, $x$, $y$ and $d \geq 3$, where $x$ is odd.</p><p>The ...</p>https://cp-algorithms.com/algebra/factoring-exp.html Sat, 16 Apr 2022 22:54:14 +0000Continued fractions<!--?title Continued fractions --><h1>Continued fractions</h1><p><strong>Continued fraction</strong> is a representation of a real number as a specific convergent sequence of ra...</p>https://cp-algorithms.com/algebra/continued-fractions.html Thu, 31 Mar 2022 16:21:16 +0000MEX task (Minimal Excluded element in an array)<h1>MEX (minimal excluded) of a sequence</h1><p>Given an array $A$ of size $N$. You have to find the minimal non-negative element that is not present in the array. T...</p>https://cp-algorithms.com/sequences/mex.html Fri, 25 Feb 2022 06:55:18 +0000Convex hull construction<h1>Convex Hull construction</h1><p>In this article we will discuss the problem of constructing a convex hull from a set of points.</p><p>Consider $N$ points given on a p...</p>https://cp-algorithms.com/geometry/convex-hull.html Mon, 11 Oct 2021 17:25:19 +0000Preview<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script><script type="text/javascript"> $(document).ready(function(){ ...https://cp-algorithms.com/preview.html Sat, 09 Oct 2021 18:40:59 +0000Half-plane intersection - S&I Algorithm in O(N log N)<h1>Half-plane intersection</h1><p>In this article we will discuss the problem of computing the intersection of a set of half-planes. Such an intersection can be con...</p>https://cp-algorithms.com/geometry/halfplane-intersection.html Sat, 13 Feb 2021 13:35:39 +0000Kuhn's Algorithm - Maximum Bipartite Matching<h1>Kuhn's Algorithm for Maximum Bipartite Matching</h1><h2>Problem</h2><p>You are given a bipartite graph $G$ containing $n$ vertices and $m$ edges. Find the maximum mat...</p>https://cp-algorithms.com/graph/kuhn_maximum_bipartite_matching.html Sat, 14 Nov 2020 19:34:36 +0000