String matching algorithms try to find where a pattern string is found within a larger text string. The naive string matching algorithm compares characters one by one between the pattern and each substring of the text of the same length. The Rabin-Karp algorithm uses a rolling hash to quickly compare the hash of the pattern to the hash of each substring, only doing a full character comparison if the hashes match. Both algorithms output the starting positions in the text where the pattern is found.