Question: So I'm supposed to write Python code that implements the Horspool matching algorithm for finding a pattern in a text. We are supposed to add

 So I'm supposed to write Python code that implements the Horspool
matching algorithm for finding a pattern in a text. We are supposed
to add counters counting only key comparisons but not counting anything in
the creation of the shift table. The "def Horspoo!Matching(pattern,text): function should return

So I'm supposed to write Python code that implements the Horspool matching algorithm for finding a pattern in a text. We are supposed to add counters counting only key comparisons but not counting anything in the creation of the shift table. The "def Horspoo!Matching(pattern,text): function should return a list. Whose first element is the position of the 1st character of the first match(if no match, return -1) and whose 2nd element is the number of key comparisons. I have written Python code that passes 3 out of 6 tests Please help fix my code so I also pass test 2,3b, and test 3c.l will put my current code and the test cases that include the correct expected results

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!