Consider a string of length n (1 <= n <= 100000). Determine its minimum lexicographic rotation. For example, the rotations of the string “alabala” are:
alabala
labalaa
abalaal
balaala
alaalab
laalaba
aalabal
and the smallest among them is “aalabal”.
This question has already been asked on Stack but I'm re asking it as no clear solution is available. Till now I made following progress.
1. Take S, concat with reverse(S)..let P=S+reverse(S)
2.construct suffix array of above string P
Now my question is if I pick first string in suffix array of size> strlen(S)
then prefix of size strlen(S)
of this string will be minimum rotation of given string S.
Is my conclusion correct?