Algorithm purpose
Determines where the substring (pattern string) contained in the main string first occurs
algorithm
Search engine, spell check, language translation, data compression, etc
Types of algorithms
- BF algorithm, Brute-Force algorithm
- KMP algorithm
BF algorithm
Compares the pos character of the main string to the first character of the pattern string
- If equal, continue to compare subsequent characters one by one
- If not, start from the next character of the main string and compare again with the first character of the pattern string