Fast String Searching by Finding Subkeys in Subtext
暂无分享,去创建一个
‘I he string warch problem is defined as follows. Given rwo seqllences of characters, a text of n characfClS T = <t 1, t2, t3, ..,, tn> and a key of m characters K = Ckl, k2. kS, .,., km) chosen from an alphabet of q characters A = {al, a2, ..,, aq), find all indices i such that ti = kl , t(s t 1) := k2, ..,, t(i + m 1) = km. That IS. fmd aii %Jbstrings in the text which match the key. Overlapping substrings ar+: t.o be found. Thus ‘aa’ is mat&ed at 3 positions in ‘aasbaa’. Many variations of this problem exist. Only the t Irst occurrcncc of the key may be needed. There may hc rwrc than one key. The text and keys may be rn~Jlridimcnsiollal. ‘I he ‘naive’ solution is to position the key successively at each text p&ion and check for a match. If the key never (.)ccurs in the tex,t alI text characters (e.xcept perhaps the last m 1) are checked at least mcc and. if matches to prefixes df the key appear, rnz~sy text characters are checked more than once. In
[1] Robert S. Boyer,et al. A fast string searching algorithm , 1977, CACM.
[2] Donald E. Knuth,et al. Fast Pattern Matching in Strings , 1977, SIAM J. Comput..
[3] Alfred V. Aho,et al. Efficient string matching , 1975, Commun. ACM.