Tag: KMP algorithm

  • Knuth-Morris-Pratt Algorithm in Swift

    This algorithm is useful for finding matching patterns in a string.The concept is very clever, but I found it difficult to understand at first. So, I decided to visualize it First, Let’s learn what LPS is LPS is the length of the longest prefix that is also a suffix,excluding the entire string itself. In the…

    Read more