we will use our order of cyclic shifts of length L

to sort the cyclic shifts of twice the length.

And we will do that efficiently using the order of the current cyclic shifts of

length L and thus will increase the length of the source suffixes twice.

And then we will again increase it twice and so on and

at some point L will be greater than or equal to the initial string S.

And then we will have sorted the cyclic shifts of length greater than or

equal to the length of the initial string and the order of those cyclic shifts is

the same as the order of the full cyclic shifts of the initial string.

So, this is the general strategy how we'll build the suffix array of the string.

Now let's look at an example of application of these

general strategy in practice.

We use the same string in all the examples.

So this is our string, and we start with sorting the partial cyclic shifts of

length 1, which is just single characters of the string.

And the smallest is $, then go four instances of letter a and

then two instances of letter b.

And six is the position of dollar in the string and 0, 2, 4 and

5 are the positions of letters a and 1 and 3 are the positions of letters b.

In this case, the order of the partial cyclic shifts is 6, 0, 2, 4, 5, 1 and 3.