![]() | This article includes a
list of references,
related reading, or
external links, but its sources remain unclear because it lacks
inline citations. (October 2023) |
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 in a text . As with other comparison-based string searches, this is done by aligning to a certain index of and checking whether a match occurs at that index. is then shifted relative to according to the rules of the BoyerâMoore algorithm, and the process repeats until the end of 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 in requires that all characters of 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 , where is the length in characters of . ApostolicoâGiancarlo speeds this up by recording the number of characters matched at the alignments of in a table, which is combined with data gathered during the pre-processing of 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.
![]() | This article includes a
list of references,
related reading, or
external links, but its sources remain unclear because it lacks
inline citations. (October 2023) |
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 in a text . As with other comparison-based string searches, this is done by aligning to a certain index of and checking whether a match occurs at that index. is then shifted relative to according to the rules of the BoyerâMoore algorithm, and the process repeats until the end of 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 in requires that all characters of 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 , where is the length in characters of . ApostolicoâGiancarlo speeds this up by recording the number of characters matched at the alignments of in a table, which is combined with data gathered during the pre-processing of 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.