Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 47s1 days 16 hours 1 minutes 47 seconds.
Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 47s1 days 16 hours 1 minutes 47 seconds.

Sign in to watch this lesson
Algorithms - Strings · 4:11
The simplest way to find a pattern in a text tries every start and compares letter by letter. We slide aab across aaaaaaaab and watch every alignment do the maximum work, derive the O(nm) worst case, measure a billion comparisons against near-linear random text on a Mac, show that std::string::find and the Horspool searcher have bad inputs too, expose hidden costs like substr in a loop, and pin down what brute force forgets at every mismatch.