So, when we compare LCP[rank[i]] and LCP[rank[i+1]], there are two cases. First, if LCP[rank[i]] > 0, then
this means that the substring in s starting at i matches another substring in the word. When we advance from
(c) By definition, the LCP of a suffix is the number of initial characters that match the suffix that
immediately precedes it in the alphabetical listing of suffixes. For example, the [1] and [2] suffixes in the
(d) The algorithm consists of a loop that runs for N iterations. The only doubt that the algorithm might
execute in more than O(N) time is the fact that there is an inner while loop. However, the inner loop does not
12.13 See H. N. Gabow, J. L. Bentley, and R. E. Tarjan, “Scaling and Related Techniques for Computational
Geometry,” Proceedings of the Sixteenth Annual ACM Symposium on Theory of Computing (1984), 135 –
12.23 A linked structure is unnecessary; we can store everything in an array. This is discussed in reference [12].