Add Knuth, Morris and Pratt algorithm