Apex › Storage & databases

KMP string matching

Find a pattern in text in O(n+m) without ever re-reading a character. Step through the search and watch the failure function slide the pattern on a mismatch while the text pointer only moves forward.

More in Storage & databases