In computer science, the two-way string-matching algorithm is an efficient string-searching algorithm that can be viewed as a combination of the forward-going Knuth–Morris–Pratt algorithm and the backward-running Boyer–Moore string-search algorithm.