Data Structures & Algorithms

String Algorithms

String problems are often bookkeeping problems in disguise. The goal is to keep the invariant small enough to update in linear time.

8 published notes
2 planned topics
4 advanced or expert notes
basic starting level

String Algorithms

Prefix structure, automata, and linear-time matching tools.

Overview

String algorithms are full of linear-time routines that look mysterious until the maintained boundary becomes clear. The notes in this branch are written to keep that boundary explicit.

Typical Questions

  • Which prefix or suffix information is enough to continue?

  • Which transitions are reused from one position to the next?

  • When is a character comparison paid for once, and when can it repeat too many times?

How this branch is distributed

The labels are not cosmetic. They are there to signal the amount of prerequisite structure and implementation fragility you should expect before opening the note.

basic: 1 intermediate: 3 advanced: 4 expert: 0
1 basic
basic

These are the shortest on-ramp notes in this category and the ones most likely to be usable immediately in contest practice.

KMP

3 intermediate
intermediate

These notes assume the base routine is already familiar and focus on the first real structural upgrades.

Z-Function, Rolling Hash, Trie

4 advanced
advanced

These are the notes where proofs, reductions, or implementation details become the main bottleneck.

Suffix Array, Suffix Automaton, Manacher, Aho-Corasick

What is already written

These are the finished note pages in this category, each with rendered TeX, C++ code, references, and practice suggestions.

Recommended order to read this branch

The default order follows each note's dependency weight: early notes establish primitives, later notes reuse them or assume the same invariants without re-explaining them.

Next topics in this branch

These are still intentionally shown as planned or outline topics rather than shallow filler. The branch should feel incomplete in honest places instead of fake-complete everywhere.

Palindromic tree planned Suffix tree outline

Source Files and Assets

Raw files are still available here when you want the original TeX, C++, or statement assets.

Show raw files