DSAverse
String Algorithms
Loading String Algorithms...
Pattern Matching
A
B
A
B
C
A
B
A
B
A
B
A
B
text / pattern
Initializing Sorting Algorithms...
Sorting
Trees
Graphs
Preparing interactive visualizations...
String Algorithms
Loading String Algorithms...
Pattern Matching
text / pattern
Computes Z[i] — the length of the longest match between a prefix and the substring at position i. Enables linear-time pattern matching by concatenating pattern + $ + text.
An interactive step-by-step visualization for the Z-Algorithm is currently being built. You will be able to watch the Z-box shrink and extend as each Z[i] value is computed.
Back to String Algorithms