Channel: Tushar Roy - Coding Made Simple
Category: Education
Tags: pattern matchingsubstring search rabin karprabin karp pattern matchingrabin karp algorithm
Description: facebook.com/tusharroy25 github.com/mission-peace/interview/blob/master/src/com/interview/string/RabinKarpSearch.java github.com/mission-peace/interview/blob/master/python/string/rabinkarp.py github.com/mission-peace/interview/wiki In computer science, the Rabin–Karp algorithm or Karp–Rabin algorithm is a string searching algorithm created by Richard M. Karp and Michael O. Rabin (1987) that uses hashing to find any one of a set of pattern strings in a text. For text of length n and p patterns of combined length m, its average and best case running time is O(n+m) in space O(p), but its worst-case time is O(nm). In contrast, the Aho–Corasick string matching algorithm has asymptotic worst-time complexity O(n+m) in space O(m).