Lexicographically minimal string rotation: Difference between revisions

Content deleted Content added
FrescoBot (talk | contribs)
Bugfix in code for Booth's algorithm, the common minimal substring ends at index j, i is the length, cf. http://stackoverflow.com/a/11676581
Line 45:
i = f[j-k-1]
while i != -1 and S[j] != S[k+i+1]:
if S[ij] < S[k+i+1]:
k = j-i-1
i = f[i]