
Suffix Automaton
A suffix automaton is a powerful data structure that allows solving many string-related problems. For example, you can search for all occurrences of one string in another, […]
A suffix automaton is a powerful data structure that allows solving many string-related problems. For example, you can search for all occurrences of one string in another, […]
1. Overview This article is a stub and doesn’t contain any descriptions. For a description of the algorithm, refer to other sources, such as Algorithms on […]
Let there be a set of strings with the total length $m$ (sum of all lengths). The Aho-Corasick algorithm constructs a data structure similar to […]
1. Definition Let $s$ be a string of length $n$. The $i$-th suffix of $s$ is the substring $s[i \ldots n – 1]$. A suffix array will […]
1. Overview Suppose we are given a string $s$ of length $n$. The Z-function for this string is an array of length $n$ where the $i$-th element […]
1. Prefix function definition You are given a string $s$ of length $n$. The prefix function for this string is defined as an array $\pi$ of length […]
1. Overview This algorithm is based on the concept of hashing, so if you are not familiar with string hashing, refer to the string hashing article. This […]
Hashing algorithms are helpful in solving a lot of problems. We want to solve the problem of comparing strings efficiently. The brute force way of […]
You are given a matrix with n rows and m columns. Find the largest submatrix consisting of only zeros (a submatrix is a rectangular area of the matrix). 1. […]
Common problems solved using DP on broken profile include: finding number of ways to fully fill an area (e.g. chessboard/grid) with some figures (e.g. dominoes) […]
Divide and Conquer is a dynamic programming optimization. 1. Preconditions Some dynamic programming problems have a recurrence of this form: $$dp(i, j) = \min_{0 \leq […]
Suppose you have a data structure which allows adding elements in true $O(T(n))$. This article will describe a technique that allows deletion in $O(T(n)\log n)$ offline. 1. […]
A randomized heap is a heap that, through using randomization, allows to perform all operations in expected logarithmic time. A min heap is a binary tree in […]
Treap is a data structure which combines binary tree and binary heap (hence the name: tree + heap $\Rightarrow$ Treap). More specifically, treap is a […]
A Segment Tree is a data structure that allows answering range queries over an array effectively, while still being flexible enough to allow modifying the […]
Sqrt Decomposition is a method (or a data structure) that allows you to perform some common operations (finding sum of the elements of the sub-array, […]
Let, $f$ be some reversible function and $A$ be an array of integers of length $N$. Fenwick tree is a data structure which: calculates the value of […]
This article discusses the data structure Disjoint Set Union or DSU. Often it is also called Union Find because of its two main operations. This data structure provides the following […]
Sparse Table is a data structure, that allows answering range queries. It can answer most range queries in $O(\log n)$, but its true power is […]