| Learn | Algorithm - Substring Search - Python implementation of kmp algorithm |
|---|
| Python Implementation of KMP algorithm. Haystack: The string in which given pattern needs to be searched. Time complexity: Search portion (strstr method) has the complexity O(n) where Note: Following implementation returns the start position of match in haystack (if there is a match) else returns -1, for edge cases like if needle/haystack is an empty string or needle is not found in haystack. |
Read Article
https://develop.horje.com/learn/1434/reference