Can someone explain this to me? I\'ve been reading about it and it still is hard to follow.
text : ababdbaababa
pattern: ababa
table for ababa is -1 0 0
Here I have briefly described computing the prefix function and shifting through the text here.

For further information: Knuth–Morris–Pratt string search algorithm
Shifting through the text :
Text: ABC ABCDAB ABCDABCDABDE
Pattern : ABCDABD
Scenario 1 - There is/are some matching character/s in Pattern and Text.
e.g 1: In here there are 3 matching characters.
Get the value from table for 3 characters. (index 2, ABC) i.e 0
Therefore shift = 3 - 0 i.e 3

e.g 2: In here there are 6 matching characters.

Get the value from table for 6 characters. (index 5, ABCDAB) i.e 2 Therefore shift = 6 - 2 i.e 4

Scenario 2 - If there is no matching characters then shift by one.