Skip to content

Two-Way

Linear algorithm in the worst case. Divides the pattern in two factors. It proceeds from left to right while scanning the left factor, and proceeds from right to left while scanning the right factor. It inspects at most 2nm2n − m characters.

Appeared in: