0%

From Suffix Array To Burrows-Wheeler Transform

BWT: Burrows-Wheeler Transform
SA: Suffix Array

Suffix Array | 後綴數組 | 接尾辞配列(せつびじはいれつ)

s[]: the basic string, define it starts from index 1 and ends at index n with length(s) = n
s[i] means the i-th character of s
sa[]: the order of the all suffix of s
sa[i] means the i-th smallest suffix of all
rk[]: the order of the i-th suffix of s
rk[i] means the rank(from small to big) of the i-th suffix

sa[rk[i]] = rk[sa[i]] = i

How to calculate SA

define ss[l][i] as a substring of s, starts from index i with length = l or ends at index n
define rk[l][i] as the rank of of ss[l][i] of all ss[l][x] for x in [1, n]

we can calculate rk[l+l][i] like by using rk[l][i] and rk[l][l+l]