Question: So Im posting the exact same question twice in a row because the first response was incorrect. It is critical that you check the function

So Im posting the exact same question twice in a row because the first response was incorrect. It is critical that you check the function with the parameter I give in the following picture. If the out put is a list [16,12], then the counter or counters are placed correctly(meaning 12 comparisons is what is should be making) Any other outcome is incorrect. Please print your output so we know the counter or counters are in the correct place.
 So Im posting the exact same question twice in a row

.'ll AT&T 11:07 PM Expert Q&A Done Where can I add counters to this Python code that implements Horspool's algorithm for finding a pattern in a text. We are only supposed to count key comparisons(dont count anything in the creation of the shift table). The output should be a Est whose first element is the position of the first character of the first match and whose second element is the number of comparisons performed. If done correctly, after running HorspoolMatchingt barber, jim saw me ina barbershop", we should have an out put of [16,12 def HorspoolMatching (pattern, text) : m len (pattern) n len (text) if mn: return -1 table [ for k in range (256): table.append (m) for k in range (m - 1): table [ord (pattern [k])] table tuple (table) -k-1 counter-0 while k n: while j >= 0 and text[1] pattern []; =-1: return 1+1 table [ord (text [k])]

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!