Find the string matching algorithm of BM

First, the search string:
1, in Word, IntelliJ IDEA, Codeblocks and other editors have string search function.
2, string search algorithm is a search algorithm, the purpose is to find out in a long string contains a substring.

Second, the string match:
1, a string is a sequence of characters defined on a finite alphabet.
For example, ATCTAGAGA alphabet E = {A, C, G , T} on a string.
2, the string matching algorithm is to search for a string in all of P in a large T appears in the string position.
Wherein, T is called text, P mode is called, T and P are defined on the same alphabet E.
3, the string matching applications include information retrieval, spell checking, language translation, data compression and network intrusion detection.

Third, the string search and matching algorithms:
1, simple search algorithm (String Search algorithm on Naive)
2, the KMP algorithm (Knuth-Morris--Pratt algorithm)
. 3, the BM algorithm (Boyer-Moore string search algorithm)

Problem:
Given a text string T and a pattern string P, P to find the position of the T.
Notation:
m, n-: represents the length of each of T and P.
E: T P and characters are defined on the same set of letters E.
Ti, Pj: T i-th character and the j-th character P (starting at 0). Where 0≤i <m, 0≤j <n

(C) BM algorithm:

Guess you like

Origin www.cnblogs.com/ZengBlogs/p/12195606.html