Turbo-BM Algorithm - PowerPoint PPT Presentation

1 / 16
About This Presentation
Title:

Turbo-BM Algorithm

Description:

Turbo-BM Algorithm Deux m thodes pour acc l rer l'algorithme de Boyer-Moore, Th orie des Automates et Applications. , 589-600, 1992. CROCHEMORE, M., CZUMAJ, A ... – PowerPoint PPT presentation

Number of Views:32
Avg rating:3.0/5.0
Slides: 17
Provided by: 49889
Category:

less

Transcript and Presenter's Notes

Title: Turbo-BM Algorithm


1
Turbo-BM Algorithm
Deux méthodes pour accélérer l'algorithme de
Boyer-Moore, Théorie des Automates et
Applications. , 589-600, 1992. CROCHEMORE, M.,
CZUMAJ, A., GASIENIEC, L., JAROMINEK, S., LECROQ,
T., PLANDOWSKI, W. and RYTTER, W.
  • Adviser R. C. T. Lee
  • Speaker H. M. Chen

2
Turbo-BM
  • 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.

3
Good Suffix Rule 1 of the BM Algorithm.
Text
S1
S1
Pattern
Text
S1
S1
S1
Pattern
Text
S1
S1
S1
Pattern
4
Another matching
Text
S2
S1
S2
S1
Pattern
But, remember that S1 is a suffix of P.
Text
S2
S1
S2
S1
Pattern
S1
Thus,
Text
S2
S2
S1
S2
S2
Pattern
S1
S1
5
Text
S2
S2
S1
S2
S2
Pattern
S1
S1
S1
Text
S2
y
S2
x
S1
S1
S2
x
S2
x
Pattern
6
For a successful matching.
If we move only one step
S1
Text
S2
x
S2
y
S2
x
x
y
y
S2
Pattern
S1
S1
After this one step move
S1
Text
S2
y
S2
x
S2
x
S2
x
y
y
Pattern
S1
Impossible for matching.
7
Conclude We must move at least S1 - S2
steps. Condition (1) In the pervious step,
Good Suffix Rule 1 (BM) was used. Thus S1
is long and not unique. This means that there is
a period. (2)In the pervious step, S2 is
contained in S1.
S1
S2
S1
8
Turbo-skip
We compare the pattern and the text from right to
left. Turbo-BM skips the memory part which has
been matched in preceding attempt.
match
memory
Text

Pattern

9
Example
b b a a b b b b b b a b a b a b a a a b a b a b
Text
b b a b a b a b a a a b a b a b
Pattern
match
b b a a b b b b b b a b a b a b a a a b a b a b
Text
b b a b a b a b a a a b a b a b
Pattern
memory
10
Full Example
Text
b b a a b c a b a c c a a d a b a a b a a a d a
Pattern
Shift by using Good Suffix Rule 1
b b a b a a a b a
b b a b a a a b a
memory
11
Full Example
Shift by Turbo-shift
Text
b b a a b c a b a c c a a d a b a a b a a a d a
b b a b a a a b a
Pattern
memory
b b a b a a a b a
Turbo-shift aba - a 2
Shift by Good Suffix Rule 1
Text
b b a a b c a b a c c a a d a b a a b a a a d a
b b a b a a a b a
Pattern
b b a b a a a b a
We select the maximal number of shift between
Good Suffix Rule 1 and Turbo-shift.
12
Full Example
Text
b b a a b c a b a c c a a d a b a a b a a a d a
b b a b a a a b a
Pattern
b b a b a a a b a
memory
Shift by using Good Suffix Rule 1
13
Full Example
Turbo-skip
Text
b b a a b c a b a c c a a d a b a b b a b a a a
b b a b a a a b a
Pattern
memory
match is aba, but memory is a. when match gt
memory, we shift pattern by using Good Suffix
Rule 1 only.
Text
b b a a b c a b a c c a a d a b a b b a b a a a
b b a b a a a b a
Pattern
b b a b a a a b a
Shift by Good Suffix Rule 1
14
Time Complexity
  • The preprocessing phase in O(mS) time and space
    complexity and searching phase in O(n) time
    complexity.

15
References
  • Off-line serial exact string searching ,
    CROCHEMORE, M. , Oxford University Press ,
    Chapter 1 , 1997 , pp. 1-53.
  • 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. 45-63.
  • 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.
    247-267.
  • Text Algorithms , CROCHEMORE, M. and RYTTER, W. ,
    Oxford University Press , 1994.
  • Recherches de mot , LECROQ, T. , University of
    Orléans, France , 1992.
  • Experimental results on string matching
    algorithms , LECROQ, T. , Software - Practice
    Experience , Vol 25 , 1995 , pp.727-765.

16
  • THANK YOU
Write a Comment
User Comments (0)
About PowerShow.com