Apostolico–Giancarlo algorithm: Difference between revisions

Content deleted Content added
eponyms
switching to using Template:mvar and Template:math instead of math tag as to get rid of error
 
(24 intermediate revisions by 20 users not shown)
Line 1:
{{Short description|Optimization of Boyer–Moore string-search algorithm}}
{{Lead rewrite|date=September 2009}}
{{No footnotes|date=October 2023}}
'''Apostolico–Giancarlo algorithm''' is an algorithm which remembers the length of the longest suffix of the pattern ending at the right position of the window at the end of each attempt. These information are stored in a table skip. It was designed by Alberto Apostolico and Raffaele Giancarlo.
In [[computer science]], the '''Apostolico–Giancarlo algorithm''' is a variant of the [[Boyer–Moore string-search algorithm]], the basic application of which is searching for occurrences of a pattern {{mvar|P}} in a text {{mvar|T}}. As with other comparison-based string searches, this is done by aligning {{mvar|P}} to a certain index of {{mvar|T}} and checking whether a match occurs at that index. {{mvar|P}} is then shifted relative to {{mvar|T}} according to the rules of the Boyer–Moore algorithm, and the process repeats until the end of {{mvar|T}} has been reached. Application of the Boyer–Moore shift rules often results in large chunks of the text being skipped entirely.
 
With regard to the shift operation, Apostolico–Giancarlo is exactly equivalent in functionality to Boyer–Moore. The utility of Apostolico–Giancarlo is to speed up the match-checking operation at any index. With Boyer–Moore, finding an occurrence of {{mvar|P}} in {{mvar|T}} requires that all {{mvar|n}} characters of {{mvar|P}} be explicitly matched. For certain patterns and texts, this is very inefficient – a simple example is when both pattern and text consist of the same repeated character, in which case Boyer–Moore runs in {{math|O(''nm'')}}, where {{mvar|m}} is the length in characters of {{mvar|T}}. Apostolico–Giancarlo speeds this up by recording the number of characters matched at the alignments of {{mvar|T}} in a table, which is combined with data gathered during the pre-processing of {{mvar|P}} to avoid redundant equality checking for sequences of characters that are known to match. It can be seen as a generalization of the [[Galil rule]].
 
==References==
* {{cite journal |doi=10.1137/0215007 |title=The Boyer–Moore–Galil String Searching Strategies Revisited |year=1986 |last1=Apostolico |first1=Alberto |last2=Giancarlo |first2=Raffaele |journal=[[SIAM Journal on Computing]] |volume=15 |pages=98–105 |url=https://docs.lib.purdue.edu/cgi/viewcontent.cgi?article=1456&context=cstech}}
{{Reflist}}
* {{cite journal |doi=10.1016/S0020-0190(97)00107-5 |title=Tight bounds on the complexity of the Apostolico-Giancarlo algorithm |year=1997 |last1=Crochemore |first1=Maxime |last2=Lecroq |first2=Thierry |journal=[[Information Processing Letters]] |volume=63 |issue=4 |pages=195–203 |url=https://hal-upec-upem.archives-ouvertes.fr/hal-00619574/file/ipl2.pdf}}
*APOSTOLICO A., GIANCARLO R., 1986, The Boyer-Moore-Galil string searching strategies revisited, [[SIAM Journal on Computing]] 15(1):98-105.
* {{cite book |last=Crochemore |first1=M. |last2=Rytter |first2=W. |author2-link=Wojciech Rytter |year=1994 |title=Text Algorithms |publisher=[[Oxford University Press]]}}
*CROCHEMORE, M., LECROQ, T., 1997, Tight bounds on the complexity of the Apostolico–Giancarlo algorithm, Information Processing Letters 63(4):195-203.
*GUSFIELD, {{cite book |last=Gusfield |first=D., |year=1997, |title=Algorithms on stringsStrings, treesTrees, and sequencesSequences: [[Computer science|Computer Science]] and Computational Biology, |publisher=[[Cambridge University Press]]. |isbn=0-521-58519-8}}
*CROCHEMORE, M., RYTTER, W., 1994, Text Algorithms, [[Oxford University Press]].
*LECROQ, {{cite thesis |last=Lecroq |first=T., |year=1992, |title=Recherches de mot,Mots |type=Ph. D. Thesis, |publisher=[[Orléans|University of Orléans]], France.}}
*GUSFIELD, D., 1997, Algorithms on strings, trees, and sequences: [[Computer science|Computer Science]] and Computational Biology, [[Cambridge University Press]].
* {{cite journal |doi=10.1002/spe.4380250703 |title=Experimental results on string matching algorithms |year=1995 |last1=Lecroq |first1=Thierry |journal=[[Software: Practice and Experience]] |volume=25 |issue=7 |pages=727–765 |s2cid=15253073}}
*LECROQ, T., 1992, Recherches de mot, Ph. D. Thesis, [[Orléans|University of Orléans]], France.
 
*LECROQ, T., 1995, Experimental results on [[String searching algorithm|string matching]] algorithms, Software - Practice & Experience 25(7):727-765.
{{Strings}}
 
{{DEFAULTSORT:Apostolico–GiancarloApostolico-Giancarlo Algorithm}}
[[Category:AlgorithmsString onmatching stringsalgorithms]]