Question: Consider the substring pattern matching problem for a length-m pattern, P, and a length-n text, T, where one of the characters in P is a

Consider the substring pattern matching problem for a length-m pattern, P, and a length-n text, T, where one of the characters in P is a symbol, “?,” which is not in the alphabet for the text. This symbol, “?,” is a wild-card character, which matches with any character of the alphabet for the text. The pattern, P, contains exactly one “?” symbol. Show how to modify the Karp-Rabin matching algorithm for this single-pattern instance of the lexicon matching problem so that the expected running time of the resulting algorithm is O(n + m).

Step by Step Solution

3.52 Rating (176 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Here is an implementation of c code for wildcard pa... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Data Structures Algorithms Questions!