Algo.pw

Algorithm lab

Change an example and start the program to follow the algorithm step by step

Arrays

Data structures

Strings

Z-function

барабан
Start at either б. How many letters in a row match?
Start

Polynomial string hashing

лиса→1083
The letter л has the code 1083. Each new letter changes the number for the word so far.
Start

Rabin–Karp search

кот и котик
One кот stands alone and another hides inside котик. How can we find both?
Start

Suffix array

ан < анан < …
The word банан has five endings. In alphabetical order, ан comes first.
Start

Suffix automaton

б→ба→бан
Follow the letters of банан. Each step extends the piece you have already read.
Start

Ukkonen’s suffix tree

н + ан→нан
Look for нан inside банан. Join the letters on the tree edges as you go.
Start

Graph essentials

Trees

Routes and dependencies

Connectivity and spanning trees

Flows and cuts

Matching and assignment

Combinatorial search and networks