1 Turbo-BM Algorithm Adviser: R. C. T. Lee Speaker: H. M. Chen Deux méthodes pour accélérer l'algorithme de Boyer-Moore, Théorie des Automates et Applications., , CROCHEMORE, M., CZUMAJ, A., GASIENIEC, L., JAROMINEK, S., LECROQ, T., PLANDOWSKI, W. and RYTTER, W.
2 The Turbo-BM algorithm is an amelioration of the Boyer-Moore algorithm. It needs no extra preprocessing and requires only a constant extra space with respect to the original Boyer- Moore algorithm. It improves the worst-case complexity of Boyer-Moore algorithm. Turbo-BM
3 S1S1 S1S1 Text Pattern S1S1 S1S1 Text Pattern S1S1 S1S1 S1S1 Text Pattern S1S1 Good Suffix Rule 1 of the BM Algorithm.
4 S2S2 S2S2 Text Pattern Another matching: S1S1 S1S1 But, remember that S 1 is a suffix of P. S2S2 S2S2 Text Pattern S1S1 S1S1 Thus, S2S2 S2S2 Text Pattern S2S2 S2S2 S1S1 S1S1 S1S1 S1S1
5 S2S2 S1S1 Text Pattern S2S2 y x S2S2 x S1S1 S2S2 x S2S2 S2S2 Text Pattern S2S2 S2S2 S1S1 S1S1 S1S1 S1S1
6 If we move only one step S2S2 S1S1 Text Pattern S2S2 y x S2S2 x S2S2 x y After this one step move S2S2 S1S1 Text Pattern S2S2 y x S2S2 x S1S1 S2S2 x y y S1S1 y S1S1 For a successful matching. Impossible for matching.
7 Conclude : We must move at least |S 1 | - | S 2 | steps. Condition : (1) In the pervious step, Good Suffix Rule 1 (BM) was used. Thus S 1 is long and not unique. This means that there is a period. (2)In the pervious step, S 2 is contained in S 1. S1S1 S2S2 S1S1
8 We compare the pattern and the text from right to left. Turbo-BM skips the memory part which has been matched in preceding attempt. Text = Pattern = memory match Turbo-skip
9 bbaabbbbbbabababaaababab bbabababaaababab Text = Pattern = bbaabbbbbbabababaaababab bbabababaaababab Text = Pattern = Example memory match
10 bbaabcabaccaadabaabaaada bbabaaaba Text = Pattern = bbabaaaba Shift by using Good Suffix Rule 1 Full Example memory
11 bbaabcabaccaadabaabaaada Text = Pattern = bbabaaaba memory bbabaaaba Turbo-shift= |aba| - |a| = 2 Shift by Turbo-shift bbaabcabaccaadabaabaaada Text = Pattern = bbabaaaba Shift by Good Suffix Rule 1 bbabaaaba We select the maximal number of shift between Good Suffix Rule 1 and Turbo-shift. Full Example
12 bbaabcabaccaadabaabaaada Text = Pattern = bbabaaaba bbabaaaba memory Shift by using Good Suffix Rule 1 Full Example
13 bbaabcabaccaadababbabaaa Text = Pattern = bbabaaaba memory match is aba, but memory is a. when |match| > |memory|, we shift pattern by using Good Suffix Rule 1 only. Turbo-skip bbaabcabaccaadababbabaaa Text = Pattern = bbabaaaba bbabaaaba Shift by Good Suffix Rule 1 Full Example
14 The preprocessing phase in O(m+Σ) time and space complexity and searching phase in O(n) time complexity. Time Complexity
15 References Off-line serial exact string searching, CROCHEMORE, M., Oxford University Press, Chapter 1, 1997, pp Deux méthodes pour accélérer l'algorithme de Boyer-Moore, CROCHEMORE, M., CZUMAJ, A., GASIENIEC, L., JAROMINEK, S., LECROQ, T., PLANDOWSKI, W. and RYTTER W., Rouen France, 1991, pp Speeding up two string matching algorithms, CROCHEMORE, M., CZUMAJ, A., GASIENIEC, L., JAROMINEK, S., LECROQ, T., PLANDOWSKI, W. and RYTTER, W., Algorithmica, Vol 12, 1994, pp Text Algorithms, CROCHEMORE, M. and RYTTER, W., Oxford University Press, Recherches de mot, LECROQ, T., University of Orléans, France, Experimental results on string matching algorithms, LECROQ, T., Software - Practice & Experience, Vol 25, 1995, pp
16 THANK YOU