This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center
我无法理解以下内容:
我们有字符串ABRACADABRA。我们将其分组作为示例:
S分为以下组:
S0 = <S[3i]S[3i + 1]S[3i + 2] for i = 0,1,2...>其中<>表示数组,S[i]表示Si位置的字符。
我本以为S0=<S[0]S[4]S[8]S[11]>会这样,但根据我读过的书中的“解决方案”,它并不像S0=[ABR][ACA][DAB][RA]那样本质上是S[0]S[3]S[6]S[9]
那么我在公式中读错了什么?
如果重要的话,这是我读过的关于后缀数组的一章。我只是在配方上有问题

最佳答案

S0=[ABR][ACA][DAB][RA]不是S[0]S[3]S[6]S[9]S[0]S[3]S[6]S[9]将是AADR
这就是发生的情况:
对于i=0
<S[3i]S[3i+1]S[3i+2]> = <S[3*0]S[3*0+1]S[3*0+2]> = <S[0]S[1]S[2]> = <ABR>
对于i=1
<S[3i]S[3i+1]S[3i+2]> = <S[3*1]S[3*1+1]S[3*1+2]> = <S[3]S[4]S[5]> = <ACA>
对于i=2
<S[3i]S[3i+1]S[3i+2]> = <S[3*2]S[3*2+1]S[3*2+2]> = <S[6]S[7]S[8]> = <DAB>
对于i=3
<S[3i]S[3i+1]S[3i+2]> = <S[3*3]S[3*3+1]S[3*3+2]> = <S[9]S[10]S[11]> = <RA >

关于string - S [3i] S [3i + 1] S [3i + 2]的含义,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13895454/

10-11 19:34