Content deleted Content added
→Booth's Algorithm: Fixed bug in bugfix. Yep. |
→Booth's Algorithm: Fixed to much nicer implementation |
||
Line 39:
def LCS(S):
n = len(S)
for j in range(1, 2*n):
i = f[j-k-1]
if S[
return k▼
k = j-i-1
i = f[i]
if i == -1 and S[j
if S[j
k = j
f[j-k] = -1
else:
f[j-k] = i+1
</source>
Of interest is that removing all lines of code which modify the value of '''''k''''' results in the original Knuth-Morris-Pratt preprocessing function, as '''''k''''' (representing the rotation) will remain zero
===Shiloach's Fast Canonization Algorithm===
|