An Efficient Algorithm for 2-Dimensional Pattern Matching Problem

Abstract Pattern matching is the area of computer science which deals with security and analysis of data. This work proposes two 2D pattern matching algorithms based on two different input domains. The first algorithm is for the case when the given pattern contains only two symbols, that is, binary symbols 0 and 1. The second algorithm is in the case when the given pattern contains decimal numbers, that is, the collection of symbols between 0 and 9. The algorithms proposed in this manuscript convert the given pattern into an equivalent binary or decimal number, correspondingly find the cofactors of the same dimension and convert these cofactors into numbers if a particular cofactor number matches indicate the matching of the pattern. Furthermore, the algorithm is enhanced for decimal numbers. In the case of decimal numbers, each row of the pattern is changed to its decimal equivalent, and then, modulo with a suitable prime number changes the decimal equivalent into a number less than the prime number. If the number mismatched pattern does not exist, the complexity of the proposed algorithm is very low as compared to other traditional algorithms.