Abstract

In this paper, we present a novel idea for a single pattern matching in strings. The idea is named skip search (SS). The pattern is checked for presence in the given text by accessing only half the memory locations even for the worst case. The search is a modified version of the Naive search algorithm by accessing only half the characters in the given string and by checking if those characters are the starting or ending character of the pattern. By doing this, we could obtain the skip length of the pattern size and hence reduce the search time. Since there is no preprocessing phase or no extra memory space required, the algorithm is good in terms of space complexity. The time taken for execution is compared with Naive algorithm and Knuth–Morris–Pratt (KMP) algorithm, and the skip algorithm gave a better performance for most of the test cases. The algorithm has a big difference in execution time when the pattern is present toward the end of the text or if the pattern is not present in the text. The algorithm can be recommended for any pattern matching projects.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call