This study aims to determine the most effective search method between the Boyer–Moore algorithm and the Knuth–Morris–Pratt (KMP) algorithm for searching recipe data in a database. The research was conducted by comparing the performance of these two search algorithms using a collection of food recipe names stored in a database. The comparison was based on two criteria: search processing speed and memory usage efficiency. The Boyer–Moore algorithm performs pattern matching by comparing characters from the end of the pattern toward the beginning, starting with the last character of the keyword or pattern. In contrast, the Knuth–Morris–Pratt (KMP) algorithm performs pattern matching by comparing characters from the beginning of the pattern toward the end, starting with the first character of the keyword or pattern. The objective is to evaluate which algorithm provides better performance for recipe data retrieval in terms of speed and memory efficiency. The research results indicate that the Knuth–Morris–Pratt (KMP) algorithm demonstrated better performance than the Boyer–Moore algorithm in terms of search speed. The KMP algorithm achieved an average search time of 6.6 milliseconds, whereas the Boyer–Moore algorithm required an average search time of 17.8 milliseconds .
Copyrights © 2026