1 / 13

Raita Algorithm

Raita Algorithm. Tuning the Boyer-Moore-Horspool string searching algorithm , Software - Practice & Experience, 22(10):879-884 T. RAITA Advisor: Prof. R. C. T. Lee Speaker: H. M. Chen. String Matching Problem.

bambi
Download Presentation

Raita Algorithm

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Raita Algorithm Tuning the Boyer-Moore-Horspool string searching algorithm, Software - Practice & Experience, 22(10):879-884 T. RAITA Advisor: Prof. R. C. T. Lee Speaker: H. M. Chen

  2. String Matching Problem • Given a pattern string P of length m and a text string T of length n, we would like to know whether there exists an occurrence of P in T. Text Pattern

  3. Basic idea • For each position of the search window, we compare its last character(ß) with the last character of the pattern. • If they match, we compare the first character of the pattern with that of the window. If they match , we compare the middle character of the pattern with that of the window. Then, we search the pattern from second character to the end until we either find the pattern or fail on a text character. Forward search ß Text 2 3 1 Pattern

  4. Basic idea • Then, whether there was a match or not, we shift the window according to the next occurrence of the letter ß in the pattern. Text ß Safe shift ß no ß αin this part

  5. If a mismatch or a complete match occurs, the Raita algorithm uses the Horspool Algorithm.

  6. Preprocessing phase raBc table P = p0p1…pm-2pm-1.The value of pm-2is set to 1, the value of p0 is m-1. The value is increase towards to left from pm-2 to p0. We choose the smallest value of each alphabet. The value of other alphabet(*) is set to m. Example : T : P : 7 6 5 4 3 2 1

  7. Example(1/4) A C G * 1 6 2 8 First attempt mismatch Secnod attempt mismatch 2 1

  8. Example(2/4) A C G * 1 6 2 8 Third attempt mismatch 2 1 Fourth attempt 2 3 4 5 6 7 8 1

  9. Example(3/4) A C G * 1 6 2 8 Fifth attempt mismatch Sixth attempt mismatch

  10. Example(4/4) A C G * 1 6 2 8 Seventh attempt mismatch 2 1 The Raita algorithm performs 18 character comparisons on the example.

  11. Time complexity • preprocessing phase in O(m+σ) time and O(σ) space complexity. • searching phase in O(mn) time complexity. (σ is the number of storing characters)

  12. References • RAITA T., 1992, Tuning the Boyer-Moore-Horspool string searching algorithm, Software - Practice & Experience, 22(10):879-884. • SMITH, P.D., 1994, On tuning the Boyer-Moore-Horspool string searching algorithms, Software - Practice & Experience, 24(4):435-436.

  13. THANK YOU

More Related