Learn

Great job with getting kmp_algorithm() to work! Now we can come full circle and put it to the test against the same pattern and text that took naive_pattern_matching() a really long time to figure out back in Exercise two.

Then, we will put it to the test against an even bigger input that took rabin_karp_algorithm() a really long time to run.

Instructions

Click Run to see our Knuth-Morris-Pratt algorithm go up against the Rabin-Karp algorithm. In the two examples, which algorithm runs faster? When is the performance most different?

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?