Hi
In computer science, the Boyer–Moore string search algorithm is an efficient string searching algorithm that is the standard benchmark for practical string search literature.It was developed by Robert S. Boyer and J Strother Moore in 1977.The algorithm preprocesses the string being searched for (the pattern), but not the string being searched in (the text).
The key features of the algorithm are to match on the tail of the pattern rather than the head, and to skip along the text in jumps of multiple characters rather than searching every single character in the text. (Source:Wikipedia )
Following code is an implementation of Boyer-Moore uses PL/SQL
CODE:
PATTERN:='abacbb';
TEXT:='abacaxbaccabacbbaabb';-- FOUND
PATTERN:='74879';
TEXT:='1256564114132775648574879577437273127615761516541189456588322';
--FOUND
PATTERN:='cite';
TEXT:='You have got a funny face, man'; --NOT FOUND
PATTERN:='banana';
TEXT:='I wish I had_an apple instead of'; --NOT FOUND
PATTERN:='74879';
TEXT:='125656411413277564857487 9577437273127615761516541189456588322';
-- NOT FOUND
PATTERN:='LEAD';
TEXT:='JIMY_HAILED_THE_LEADER_TO_STOP';--FOUND
Hiç yorum yok:
Yorum Gönder