The Shift OR algorithm uses bitwise techniques to check whether the given pattern is present in the string or not. It is efficient if the pattern length is lesser than the memory-word size of the machine (In this article at OPENGENUS, we consider the memory-word size to be 64bits). We are given string, string length, and the pattern. Our job is to return the starting index of the pattern if the pattern exists in the string and -1 if it does not exist.
For Example:
Input:
Text: OpengenusPattern...
Published on May 16, 2021 13:31