note: This article comes from the Internet. Please contact me via lethic@163.com if there is any infringement.
lethic@163.com.
Min(s)Min(s)Min(s)egMin(babba) = 4p1, p2p1s[0]p2s[1]
(1) p1, p2p1s[0], p2s[1]
(2) k = 0s[p1+k] s[p2+k] k++(k)s[p1+k] s[p2+k]
(A). s[p1+k] > s[p2+k]p1p1+k+1 — s1[p1->p1+k]
(B). s[p1+k] < s[p2+k]p2p2+k+1 (C). s[p1+k] = s[p2+k] k++ if (k == len) :p1 == p2+1p1p2 len (3) k == len p1p2 p1 >= len p2
p2 >= len p1
(4) p1p1+k+1p1+k+1 <= p2p1 p2p2p2+kp1p1+kp2p1+1
O(n)p1 == p2+1http://acm.zju.edu.cn 20061729100001000000S0.05S
.
ppthttp://www.chhaya.me/?p=229.
i=0,j=1.s[i]s[j]k,k==len,i,j.s[i+k]s[j+k],s[i+k]>s[j+k]s[i+1]s[i+k],i=i+k+1.s[i+k]?Download sourceCode.cpp
code
more code
~~~~