Question: How can I take this python function for filling in a shift table (it is already using Horspools and Boyer-Moore algorithms) And change it to

How can I take this python function for filling in a shift table (it is already using Horspools and Boyer-Moore algorithms)
 How can I take this python function for filling in aAnd change it to return a shift table that is a dictionary of letter-shift distance pairs. For example, the changed function def shiftTable(pattern) would return (once implemented correctly in Python) {a:4,b:2,e:1,r:3}
if we ran the function with the pattern barber

def shiftTable(pattern): m-len(pattern) table = [] for k in range(256) table.append(m) for k in range(m-1): table(ord(pattern[k]))-m-k- 1 table - tuple(table) return table print(shiftTable(leader)) print(shiftTable(recorder)) print(shiftTable(TCCTATTCTT'))

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!