Developer docs · Algorithms
String algorithms · Math and number theory · Bit manipulation · Segment trees · Union-find
String algorithms find patterns in text and look up words by prefix; KMP, Rabin-Karp, tries and the Z-algorithm are the core techniques.
6-chapter guideGCD and LCM, modular arithmetic and inverses, fast exponentiation, the sieve of Eratosthenes and nCr mod p: the number theory toolkit for algorithms.
6-chapter guideBit manipulation treats integers as binary digits and uses AND, OR, XOR and shifts to handle sets, flags and bitmask DP quickly and compactly.
6-chapter guideA segment tree answers range sum and minimum queries and applies point updates in O(log n); the Fenwick tree is its lighter cousin for sums.