Minimum Lexicographic Rotation Using Suffix Array

后端 未结 3 1946
你的背包
你的背包 2021-01-06 10:08
    Consider a string of length n (1 <= n <= 100000). 
    Determine its minimum lexicographic rotation. 
    For example, the rotations of the string “alabala         


        
3条回答
  •  长发绾君心
    2021-01-06 10:52

    It seems that you should take first suffix in SA, which index is between 0 and length(S) - 1.

    Some explanation: all rotations of S are in the beginning of S' suffixes from positions between 0 and length(S) - 1. Suffix array keeps suffixes in lexicographical order, so you just need to pick the first one which begins from rotation of S.

提交回复
热议问题